Article View: net.lang.c++
Article #241Re: Cornell Bug Report #0 of 4
From: cmc
Date: Tue, 24 Jun 1986 20:48
Date: Tue, 24 Jun 1986 20:48
34 lines
1978 bytes
1978 bytes
In article <498@batcomputer.TN.CORNELL.EDU> gdykes@batcomputer.UUCP (Gene Dykes) writes: >... >% CC -c bug.c >CC bug.c: >cc -c bug..c -lC > >% cc bug.o -o bug -lC >% bug >Bus error (core dumped) > >... > > 1) a program cannot be compiled by CC and loaded by cc > The problem arises if your C++ program uses static constructors and/or destructors. A big problem with such programs is that the compiler has to insert a call to a special routine which calls all of the constructors *before* the program starts executing for proper. This cannot be done during the initial compiling stage as the compiler cannot know what constructors will be called from other modules, e.g. the constructors for the standard streams (cout, cin, cerr) in libC.a. The solution used depends on whether you are working on a system with libld.a. If you are, a program called patch is used to build a list of pointers to static constructors and patch it into the executable, On other systems nm(1) is run on the executable and the output piped into a special program called munch. This spots symbols which are static constructors and generates a C file which is then compiled and the whole executable is relinked (now you see why compiling/linking can take an age!) The reason your program bus errored is that the stream package is not being initialised. Chris.
Technical Details
Message-ID:
<1493@rlvd.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!whuxl!whuxlm!akgua!gatech!seismo!mcvax!ukc!warwick!rlvd!cmcReferences:
<498@batcomputer.TN.CORNELL.EDU>Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!whuxl!whuxlm!akgua!gatech!seismo!mcvax!ukc!warwick!rlvd!cmc From: cmc@rlvd.UUCP Newsgroups: net.lang.c++ Subject: Re: Cornell Bug Report #0 of 4 Message-ID: <1493@rlvd.UUCP> Date: Tue, 24-Jun-86 16:48:34 EDT Article-I.D.: rlvd.1493 Posted: Tue Jun 24 16:48:34 1986 Date-Received: Sat, 28-Jun-86 07:36:36 EDT References: <498@batcomputer.TN.CORNELL.EDU> Sender: news@rlvd.UUCP Reply-To: cmc@rlvd.UUCP (Chris Crampton) Organization: Informatics Division, R.A.L Lines: 34