D
dilabox
Hello,
I have overloaded the global new, delete, new[] and delete[] operators
inside a "static library". The library uses private memory allocation
routines that must not be accessible from other translation units.
Other translation units are therefore expected to define and use their
own new/delete operators.
When I link to this library the global new/delete operators conflict,
and although no linker warnings are generated, the result is that
translation units access each others memory allocation routines.
How can I limit the scope of these operator definitions? Apparently it
is not enought to declare them as 'inline' functions, which should only
make them available to translation units which explicitly include the
headers where they are defined.
To avoid this ambiguity I have considered overloading one set of
operators with redundent parameters, such as: void* operator new(
size_t, int )
Any thoughts apreciated.
Thanks in advance,
- dila
I have overloaded the global new, delete, new[] and delete[] operators
inside a "static library". The library uses private memory allocation
routines that must not be accessible from other translation units.
Other translation units are therefore expected to define and use their
own new/delete operators.
When I link to this library the global new/delete operators conflict,
and although no linker warnings are generated, the result is that
translation units access each others memory allocation routines.
How can I limit the scope of these operator definitions? Apparently it
is not enought to declare them as 'inline' functions, which should only
make them available to translation units which explicitly include the
headers where they are defined.
To avoid this ambiguity I have considered overloading one set of
operators with redundent parameters, such as: void* operator new(
size_t, int )
Any thoughts apreciated.
Thanks in advance,
- dila