I support a plugin (implemented as a dll) for a large closed source application. This has worked great for many years. However, with the latest update to it, the SDK provider overloads global operators with new ones and deletes. This causes a lot of problems for me. What happens is that my plugin highlights a line. I pass this line to a statically linked library that modifies it (changes the length by redistributing it). My application crashes.
Of course, the reason is that the string lives on the distributed user heap of the provider. The statically linked library knows nothing about this heap and tries to use the default new / delete operators in this memory. Boom.
Now the question is: how can I keep my code clean and avoid using provider operators? A preprocessor macro does not exist. I canβt avoid including the offensive title, as it contains 2,000 lines more code that I need for the plugin. I cannot transfer the provided allocator to another library, because it does not provide any mechanisms for this. I already listened to this provider. I don't know what else could I try?
Addendum: After some heated debate, I managed to convince the seller to remove overloads from the next version of the SDK again. I solved my immediate problem by simply cracking the current SDK and removing the overloads manually. Thanks for all the suggestions in this thread. They served as arguments and further "proof" of why overloads were bad ideas in the first place.
c ++ memory-management new-operator operator-overloading allocation
BuschnicK Jan 05 '10 at 16:05 2010-01-05 16:05
source share