🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Urs Hoelzle Tue, 26 Jan 1993 02:18
g++ 2.3.3 ignores 'extern "C"'
#1422
Author: Urs Hoelzle
Date: Tue, 26 Jan 1993 02:18
30 lines
1726 bytes
-------- x.c ---------------
# include <stdlib.h>
# include <malloc.h>

extern "C" void* malloc(int size) {  return 0; }
---------------------------

g++ -v -c x.c -o x.o ; nm x.o
Reading specs from /home/kahuna/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/specs
gcc version 2.3.3
 /home/kahuna/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix x.c /usr/tmp/cca26496.i
GNU CPP version 2.3.3 (sparc)
 /home/kahuna/local/lib/gcc-lib/sparc-sun-sunos4.1/2.3.3/cc1plus /usr/tmp/cca26496.i -quiet -dumpbase x.cc -version -o /usr/tmp/cca26496.s
GNU C++ version 2.3.3 (sparc) compiled by GNU C version 2.3.3.
 as -o x.o /usr/tmp/cca26496.s
00000000 T _malloc__Fv
00000000 t gcc2_compiled.


i.e. g++ generates a mangled name (_malloc__Fv) instead of _malloc.  If you
take out the inlcude of <malloc.h> it works.

g++ 2.2.2 already had problems with this ("program cc1plus got fatal
signal 11").

-Urs

----------------------------------------------------------------------------
Urs Hoelzle                                              urs@cs.stanford.EDU
Computer Systems Laboratory, CIS 57, Stanford University, Stanford, CA 94305
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads