delete objects declared in a DLL

Hi,
This is my problem:
-I've a WIN32 Application.
-My Application allocates(using the operator "new") objects of classes
declared in a DLL.
-When I try to delete these objects the compiler returns an error of this
type"debug assertion failed....file dbgheap.c"
Does someone know where is the problem?
Thanks to all can help me.
M


0
11/11/2005 3:43:41 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
383 Views

Similar Articles

[PageSpeed] 20

It does not matter whether objects are declared in a DLL or in a EXE. You
will have the same issue if the object you created was declared/created in
an EXE. Show the code where you create/declare the object/class.

--
Ajay Kalra [VC++ MVP]
ajaykalra@yahoo.com


"Micheles" <NOTVALIDmichele.perozziNOTVALID@virgilio.it> wrote in message
news:4374c313_1@x-privat.org...
> Hi,
> This is my problem:
> -I've a WIN32 Application.
> -My Application allocates(using the operator "new") objects of classes
> declared in a DLL.
> -When I try to delete these objects the compiler returns an error of this
> type"debug assertion failed....file dbgheap.c"
> Does someone know where is the problem?
> Thanks to all can help me.
> M
>
>


0
ajaykalra (6842)
11/11/2005 4:21:03 PM
you are free/delete-ing memory incorrectly. check your strings and make sure
that you are doing this well. if you are using COM  you need to be extra
careful of Release.

> Hi,
> This is my problem:
> -I've a WIN32 Application.
> -My Application allocates(using the operator "new") objects of classes
> declared in a DLL.
> -When I try to delete these objects the compiler returns an error of this
> type"debug assertion failed....file dbgheap.c"
> Does someone know where is the problem?
> Thanks to all can help me.
> M

-- 
new
0
11/11/2005 4:21:11 PM
Here there is a better description of my problem:

1)In the DLL I have the class pippo :

class DLLEXPORT pippo
{
public:
    pippo();
    virtual ~pippo();
    int i;
    int j;
    pippo *punt;
};

pippo::pippo():i(0),j(0)
{
    punt=NULL;
}
pippo:: ~pippo()
{
};

2)In the EXE I have:
pippo *p=new pippo();
delete p; HERE IS THE PROBLEM
Thanks
M.
"Micheles" <NOTVALIDmichele.perozziNOTVALID@virgilio.it> ha scritto nel 
messaggio news:4374c313_1@x-privat.org...
> Hi,
> This is my problem:
> -I've a WIN32 Application.
> -My Application allocates(using the operator "new") objects of classes
> declared in a DLL.
> -When I try to delete these objects the compiler returns an error of this
> type"debug assertion failed....file dbgheap.c"
> Does someone know where is the problem?
> Thanks to all can help me.
> M
>
> 


0
11/11/2005 4:48:01 PM
This sounds as a heap mismatch (for example, using static CRT in your dll 
and/or in the client, or using release dll CRT in one and debug dll CRT in 
the other)

In order to fix this error, make sure that both dll and client are using the 
multithreaded dll CRT, both debug for a debug build and both release for a 
release build.  Also, make sure that any dependencies use the same CRT.

Read How to link with the correct C Run-Time (CRT) library
http://support.microsoft.com/default.aspx?scid=kb;en-us;140584


-- 
Un saludo
Rodrigo Corral Gonz�lez [MVP]

FAQ de microsoft.public.es.vc++
http://rcorral.mvps.org




0
11/11/2005 5:08:55 PM
Reply:

Similar Artilces:

How can I delete entire inbox?
Hi, Is there a way to empty and/or delete the total inbox folder? The account has so much spam and don't want to delete 1000 spam messages one by one. Thanks for any help! Select first email, hold down shift, use down arrow to select all = messages, presss delete. --=81 Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my personal account will be deleted without reading. =20 After furious head scratching, egb88 asked: | Hi, | Is there a way to empty and/or delete the total inbox folder? The | account has so much...

Using Remove History to delete old financial data
My company would like to remove financial data from 1995-1999 on our SQL Server. We are running Dynamics 9.0. Would performing Tools >> Utilities >> Financial >> Remove History remove the data from SQL Server (i.e. table GL30000) and any other tables that would have financial data related to these years or do I have to run a series of SQL scripts against the database tables to delete the data? Thanks for all help in advance. -- Dave Christman System Developer ...

Re: Massive "FIND" or " Compare cells " then , Delete....
Hello All, lets say I have in Column A, Dan, John, Bill, Angela, Fred ...many entries of the same names.... In Column B, I have Nancy, Dan, Steve, I want to delete all of the "Dans" in both columns ... Can I do something like: =compare( A1:B20 ) , delete,*.*)) I tried Subsitute, FIND, REPLACE.... Help! I am Confused!!!! :) Select A1:B100 (assuming that is your range), do Edit / Replace, replacing Dan with nothing, then with the range still selected do Edit / Go To / Special / Blanks, then Edit / Delete / Shift Cells UP. This assumes you want ...

Deleting original text on reply or forward
Hiya.. I have a user that, when they receive a message from a particular law firm, and they attempt to reply to it, the text from the original message is removed, though, the law firms 'disclaimer' remains intact. This also happens on forwards. This user does not have their Outlook set to remove the text in their options.. And as stated, this only happens with this particular law firm. I have opened the email message, and looked for macros, but there don't appear to be any. So.. my question is: How are they doing it? How does this law firm force recipients to lose the origi...

How use Property sheet from a DLL library?
Hi, All, I want to create a common extension DLL library that only includes one property Sheet with more than one property pages. this DLL also includes a invoke API that can be called by Win32 application. my problem is that I can't Add property pages to property sheet and error message shows Resource was unvailable inside invoke API. below is some sample code: In MyProp.dll includes these: 1) void InvokeApi(HWND Hwnd, HINSTANCE hLib, ...); 2) class CPage1: public CPropertyPage{ ...} 3) class CPage2: public CPropertyPage{ ...} 4) class CMySheet: public CPropertySheet{ ...} here is I...

How to find default property for particular object.
Hi, is there a way how to identify default property for given object. E.g., I know default property for range object is value. Where can I find the default property for other objects? Thanks Alojz Hi, AFAIK, the only default property for an Excel object is 'value'. If an object doesn't have a value property then it also doesn't have a default property. Mike When competing hypotheses are otherwise equal, adopt the hypothesis that introduces the fewest assumptions while still sufficiently answering the question. "Alojz" wrote: > Hi, ...

Delete a user
How can I delete a user once all records have been re-assigned and all licenses and security roles removed? You can't remove users. ...

How to delete?
I amusing Money Plus Premium, and I have a problem I hope you can help with. T Rowe Price changed my user name, so my online services no longer worked. So I stopped Online updates, and re-created it. I got a bunch of statements and recent transactions even though I said I did not want any transactions. So I went through them, but I think by mistake I accepted a match that was incorrect, so my current balance of one fund was wrong. After trying to figure out what the transaction was, and redoing the process again, I went back to yesterday's backup and started over. But now, I hav...

Keeping Deleted Items Folder Cleaned Up
I'm trying to add a rule that will delete any item over 2 years old in my deleted items folder. The rules wizard only lets me select the inbox. I delete stuff but don't clear deleted box in case I need it later. Is there a way that I could send a deleted email to a temporary folder and have a rule for it to send it to the deleted box and have my deleted box emptied whenever I log out? Thanks for your help, Marw ...

hOW TO DELETE THE
"KimSingh" <KimSingh@discussions.microsoft.com> wrote > How to delete the - in (23-HFV51), I have lots of rows with data. Assume the source is in col A, A2 down Put in B2: =SUBSTITUTE(A2,"-","") Copy down Copy col B, then paste special as values to overwrite col A -- Rgds Max xl 97 --- GMT+8, 1� 22' N 103� 45' E xdemechanik <at>yahoo<dot>com ---- Edit>Replace what: - with: nothing Replace all. Gord Dibben Excel MVP On Mon, 21 Mar 2005 09:07:02 -0800, "KimSingh" <KimSingh@discussions.microsoft.com> wro...

Conditional Delete
I want to delete all cells that contain specific text. Any help would be appreciated! I'd select that column and do Data|Filter|autofilter Then use the dropdown and choose custom contains: (type in your value) And delete the visible rows Then data|Filter|autofilter (to remove the filter) ======= You may be able to chose the value you want from the dropdown, too--avoiding the Custom stuff. gsxith3@embarqmail.com wrote: > > I want to delete all cells that contain specific text. Any help would > be appreciated! -- Dave Peterson Edit>Find what: yourtext Find all. ...

DLL problem-due to _CrtIsValidHeapPointer(const void * pUserData=0x01482868)
Hello All, I have a problem with "Unhandled Exception", when I run my library file which is built on VC++6.0 and run on vc++ 7.0, but it works just fine, if I run the same library on VC++6.0 with other applicaitions, can anyone tell me why this problem occurs and guide me where I need to look for fixing this problem. Thanks in advance. Dhananjaya ...

deleting a record after copying data
I currently have code in a form called workorders to execute after update to copy data over to a new form called Closed_Workorders. using two different tables (tasks and closed tasks) How do I write the code to delete the record once it is copied. "Thanks for your Support" Here is the code: Private Sub Status_AfterUpdate() If Status = "Completed" Then Dim StDocName As String Dim StDocnbr As String StDocName = "Completed_WorkOrders" StDocnbr = [Log_Number] DoCmd.OpenForm StDocName DoCmd.GoToRecord , , acNewRec Forms![Completed_WorkOrders]...

Will deleting a Form delete attached code? AND How to see ALL code in dB ?
1 Will deleting a Form delete any code attached to the form? 2 Is there a way to see all the code associated with an Access data base? 3 - Or must you open every form and ask for code view? Or what? 3 - Can you print all the code out at once or must you open each object and print code associated with that object? thanks for the help. Mel "Mel" <MyEmailList@gmail.com> wrote in message news:1177956107.236707.142280@h2g2000hsg.googlegroups.com... >1 Will deleting a Form delete any code attached to the form? Well, the answer is "kind of" yes. It is important t...

why does deleted email have a line thru it
I have 2 email accounts. One works fine. On the other; when I delete an email I have a line thru it and the email stays in the inbox and cannot be removed. Help. Did you try and hit Send\Receive when the line is through the message. Does it delete then -- Peter Please Reply to Newsgroup for the benefit of others Requests for assistance by email can not and will not be acknowledged. "Michael" <Michael@discussions.microsoft.com> wrote in message news:AFDC8DB7-12D5-47C3-AA1E-74F72CF0258D@microsoft.com... >I have 2 email accounts. One works fine. On t...

Deletion of Backups
I want to automatically copy my scheduled nightly GP backup to an external drive and then delete the backup off the server. GP doesn't allow the backup directly to the external drive. What would be the best way to accomplish that? ------=_NextPart_0001_D418A9F0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Hello David, Thanks for posting in Microsoft Forums! Please note the new Forums posting area at the following URL - http://social.microsoft.com/Forums/en-US/ Recommendation is to configure a Job right within SQL Server as a scheduled Maintenance P...

#Deleted
Hello, I have a continuous form where the rs is from a main table, and one currency field from a detail table. If data is entered into the detail table field, the info is entered correctly, along with a few other default field values not displayed. My problem is, if the detail record has a value, and the user overwrites with $0 or clears the field, I wish to delete the child record. I am doing this with a runsql delete. All this is fine, but I then get a #Deleted displayed on my form. Me.requery fixes the problem but also makes the first record the current record, and ...

Deleting Outlook 2002
I have just bought Office 2003 and want to load Outlook 2003. I don't seem to be able to do this. Outlook 2002 won't delete; I've deleted in the Add/Remove programmes in the Control Panel but still the Outlook version remains 2002. I think that the best solution is to delete 2002 and then re-intall Office 2003 Can anyone help please Installing Outlook 2003 should automatically remove Outlook 2002, since only one version is allowed per machine. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Deve...

2 contacts folders with the same name, but I see just 1 of them, How to delete the 2nd?
Hi, In my outlook 2000, I managed to create a contact folder twice with the same name (I don't know how, but I did). Now both folders appear when I click on the "To" button in a new e-mail. One of them contains my contacts and the other is empty. I want to delete the empty one. The problem is that one one of those 2 folders appear under contacts and it's the one that contains my contacts (not the empty one). How can I delete the empty one? Thanks ThunderMusic Very odd. I'd love to know how you did that. You should post your mail support mode before we try anythin...

DLL and OLE automation
Is it possible to have a dll as automation client? I called AfxOleInit() in the dll's InitInstance(), but I'm not sure where to create an IDispatch object: m_OLEServ32.CreateDispatch(_T("OLEServ32.Document"),&Error); When I try to put it in one of the export functions, I get an access violation. Calling it in InitInstance gives "CoInitialize has not been called". Calling CoInitialize(NULL) manually doesn't help either. Note: I tried a normal dialog-based app as client and that works, so nothing wrong on the server side. There are limitations on what c...

Deserialize Business Object
Hi, I am having an issue deserializing a business object from a SQL stored procedure. I have created the class using the XSD tool and the resulting XMLDATA schema but when I try to create the object I get an error message <[Object] xmlns=''> was not expected. As the XML being returned is an XML fragment due to not having a single root element I have previously got around this issue by adding another table to the database which acts purely as the root element. However, I would like to do this properly rather than this bodge. Very grateful for any advice. I am using SQL...

thread to dll messages
hi i want to ask for guidence, actually i want to send a message from thread to a MFC extended DLL , what should i do, can i use sendMessage(), postmessage() function ,if yes then plz tell me , if not than what should i do to achieve this task i shall be great ful to u waiting for ur immediate respinse thanks irfan Hi, If you don't have a window in the dll (actually it could be a dialog) you simply cannot use both SendMessage and PostMessage; these functions require a handle to a window. Why not to define an export function in the dll and call it (as an imported one) from your ...

problem with AfxMessageBox in a thread in a dll
Hi, I have a problem with AfxMessageBox, I have a dll and in the dll I have a thread. when I give a message using AfxMessageBox in that thread, there is an "Debug assertion failed" , any idea about it ? thanks, Behzad >I have a problem with AfxMessageBox, >I have a dll and in the dll I have a thread. when I give a message using >AfxMessageBox in that thread, there is an "Debug assertion failed" , >any idea about it ? And if you debug it in the debugger, what does the line of source code that's throwing the assertion tell you? You really should av...

money 2007 cannot access "msvcr80.dll
I get an error when I run my nortons one button check up program integrety scan. "C:\ProgramFiles\Microsoft Money 2007\MncoreFiles\Msmoney.exe Cannot Access necessary file. "msvcr80.dll Does anyone have any suggestions except for re installing the program. Because I have already done that. -- GUYT In previous versions Norton & Money have not worked well together (a great understatement). Try this - it might work in this scenario. Uninstall Money; uninstall Norton. Reinstall Money; reinstall Norton. The theory is that Money is resident when Norton first has a look around ...

Ownership of PF objects after moving to a new environment
I'd like to move our entire Exchange 2000 environment to new Exchange 2003 hardware, which is in a completely clean, new Windows 2003 AD forest/domain. I plan to use ExMerge to dump all mailboxes (we have less than 100) to .pst, then use an Outlook client to dump our public folder structure to a .pst. I can setup PF permissions manually on the new server. My question is will the new PF environment know how to handle ownership of objects that were created by users in the old Exchange environment such as calendar entries that were created by a "John Smith"? Although I will have...