Date: Wed, 15 Dec 1999 09:12:01 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Sven Sandberg cc: djgpp AT delorie DOT com Subject: Re: is 'ld --wrap' not for C++? In-Reply-To: <3856A623.14E00791@yahoo.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp AT delorie DOT com X-Mailing-List: djgpp AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Tue, 14 Dec 1999, Sven Sandberg wrote: > -------- source file: test.cc --------- > #include > extern void *__real_malloc(size_t size); > void *__wrap_malloc(int c) > { > return __real_malloc(c); > } > int main(void) > { > free(malloc(4711)); > return 0; > } > -------- eof(test.cc) ----------------- > > command line: > gcc -Wl,--wrap,malloc -o test.exe test.cc -W -Wall > > -------- error messages --------------- > test.o(.text+0xe):test.cc: undefined reference to > `__real_malloc(unsigned long)' > test.o(.text+0x33):test.cc: undefined reference to `__wrap_malloc' I think both __wrap_malloc and __real_malloc should be declared as ``extern "C"'' in a C++ program.