Skip to main content
GameDev.net gamedev.net
🔒 Locked

Overloading new/delete

Started by ex4st Jan 20, 2003 at 6:05 PM 2 replies 550+ views
Original Post
ex4st
ex4st
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]
IFooBar
IFooBar
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
hammerstein_02
hammerstein_02
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

=*=

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.