This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Problems linking egcs-made applications with sicstus prolog
- To: roosen at ltt dot rwth-aachen dot de
- Subject: Re: Problems linking egcs-made applications with sicstus prolog
- From: "Martin v. Loewis" <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Date: Tue, 27 Jul 1999 00:06:44 +0200
- CC: gcc at gcc dot gnu dot org
- References: <379CC3F7.45E94647@telemann.ltt.rwth-aachen.de>
> 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