Overloading new/delete

Started by
2 comments, last by ex4st 21 years, 2 months ago
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]
Advertisement
AFAIK, you cannot overload those operators (like the ? operator)

[s]--------------------------------------------------------[/s]chromecode.com - software with source code
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
[size=2]aliak.net
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

=*=

This topic is closed to new replies.

Advertisement