How to prevent a globally overridden "new" operator from being linked in from external library
Posted
by mprudhom
on Stack Overflow
See other posts from Stack Overflow
or by mprudhom
Published on 2009-12-10T08:16:31Z
Indexed on
2010/04/07
1:23 UTC
Read the original article
Hit count: 402
In our iPhone XCode 3.2.1 project, we're linking in 2 external static C++ libraries, libBlue.a and libGreen.a. libBlue.a globally overrides the "new" operator for it's own memory management. However, when we build our project, libGreen.a winds up using libBlue's new operator, which results in a crash (presumably because libBlue.a is making assumptions about the kinds of structures being allocated). Both libBlue.a and libGreen.a are provided by 3rd parties, so we can't change any of their source code or build options.
When we remove libBlue.a from the project, libGreen.a doesn't have any issues. However, no amount of shuffling the linking order of the libraries seems to fix the problem, nor does any experimentation with the various linking flags. Is there some way to tell XCode to tell the linker to "have libGreen's use of the new operator use the standard C++ new operator rather than the one redefined by libBlue"?
© Stack Overflow or respective owner