guys, If I override the global new and delete in my dll code, will this override the user code new and delete? I made a test, and it shows the user new and delete will not be impacted. If I want to make user code new and delete be replaced by mine sdk new/delete, how to do that.
What's the case of template class. Template class definition includes some new/delete. And user code might instantiate it. Then, it might use user new/delete, right?
No, on Windows each DLL has its own operator new()
/operator delete()
. However you should be careful - if some DLL new
s an object that object should be delete
d using the same operator delete()
- otherwise you run into undefined behavior.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With