Archived

This topic is now archived and is closed to further replies.

ex4st

Overloading new/delete

Recommended Posts

Hi, here is my problem. I'm trying to overload the global operators 'new' and 'delete' for a DLL. But when I try to compile it says : ... error C2373: 'new' : redefinition; different type modifiers ... error C2373: 'delete' : redefinition; different type modifiers ... I've already compiled with success this class in another application. What should I do to fix it ? Thanks! [edited by - brunow on January 20, 2003 7:07:02 PM]

Share this post


Link to post
Share on other sites
Enselic: you *can* overload new/delete operators.

Brunow: Cant really say whats wrong. Could be a number of reasons. Could be becuase there are issues with using DLLs and global new/delete overloads. i dunno much about DLLs. Here is what I can think of that might be wrong.

1: The obvious: are you redefining the functions anywhere? maybe in your dll and somewhere else?
2: You might be defining operator new that returns a different value. The global new returns a void* right? so is your new also returning a void*?
3: Might be a dll issue.

maybe post your overloading code and other someone might catch something you didnt...


:::Al:::
[Triple Buffer V2.0] - Resource leak imminent. Memory status: Fragile

Share this post


Link to post
Share on other sites
There is a tutorial in the Articles and Resources section on overloading the new and delete operators to implement your own memory management (to prevent leaks). If you find that you may be able to figure out what you are doing wrong..

=*=
If things seem bad, think that they can get a whole load worse, and they don''t seem so bad anymore

=*=

Share this post


Link to post
Share on other sites