This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Problems linking egcs-made applications with sicstus prolog


> Our question now: if we overload the malloc() family with the SP_ routines
> - will the C++ operators "new" and "delete" use them, too? If yes, this
> would be a very simple and elegant way to overcome those rather nasty
> problems.

It depends on what you mean by "overload". If you mean "#define in a
header file", then no; libgcc won't see your macro. If you mean "by
modifying the source of libgcc to use our function", then definitely,
yes.

If you mean "by writing a replacement malloc function", then, as Mike
Stump says, most likely, yes (I would not call that overloading,
though). It very much depends on the C library: is it static, or is it
shared, does it contain its own copy of the new/delete operators or
not, does it define malloc/delete as weak symbols, etc. Unless you run
into a bug in the g++ or the C library, it should work. 

Please be aware that this might or might not affect the C library's
internal functioning: it uses malloc itself, e.g. in stdio.

Regards,
Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]