🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #1422

g++ 2.3.3 ignores 'extern "C"'

#1422
From: 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
Technical Details
Message-ID: <hoelzle.728002480@Xenon.Stanford.EDU>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!xenon.stanford.edu!hoelzle

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!xenon.stanford.edu!hoelzle
From: hoelzle@xenon.stanford.edu (Urs Hoelzle)
Newsgroups: gnu.g++.bug
Subject: g++ 2.3.3 ignores 'extern "C"'
Date: 25 Jan 1993 21:18:54 -0500
Organization: CS Department, Stanford University, California, USA
Lines: 31
Sender: daemon@cis.ohio-state.edu
Approved: bug-g++@prep.ai.mit.edu
Distribution: gnu
Message-ID: <hoelzle.728002480@Xenon.Stanford.EDU>