[Gc] GC_INIT on solaris

John Plevyak jplevyak at acm.org
Thu Feb 23 09:14:30 PST 2006



We've been using BoehmGC 6.5 without issue on our Linux platforms, but are
having trouble on our Sun platforms.  The output of uname -a is as
follows:

       SunOS stemp6.wc.cray.com 5.9 Generic_118558-05 sun4u sparc SUNW,Ultra-60

and the version of g++ that I'm using is 3.4.3.



In particular, the following simple program results in compilation
problems:


testgc.cpp
------------------------------------
#include "gc_cpp.h"

int main(int argc, char* argv[]) {
  GC_INIT();
}
------------------------------------


g++ -Wall -c -I ../third-party/boehmgc/gc6.5/include/ testgc.cpp
testgc.cpp: In function `int main(int, char**)':
testgc.cpp:5: error: ISO C++ forbids declaration of `end' with no type
testgc.cpp:5: error: ISO C++ forbids declaration of `etext' with no type
testgc.cpp:5: error: `GC_noop' undeclared (first use this function)
testgc.cpp:5: error: (Each undeclared identifier is reported only once for
each function it appears in.)



If I just declare "end" and "etext" to be of type "int" (just to see
if there are other issues).  This leads to the next error:

testgc.cpp: In function `int main(int, char**)':
testgc.cpp:5: error: `GC_noop' undeclared (first use this function)
testgc.cpp:5: error: (Each undeclared identifier is reported only once for
each function it appears in.)


Here, by compiling mark.c using -E, I found that the 0-argument version of
GC_noop() is being used.  However, prototyping this version of the
function within the gc.h header is problematic because the prototype is
expecting 0 arguments and we're sending in 2 for the Sun version of
GC_INIT().  Meanwhile, prototyping the varargs version results in problems
when building the BoehmGC library because it mismatches the prototype in
gc_priv.h.


We have hacked it (clearly not the 'right thing'):

943,944c943,950
< #   define GC_INIT() { extern end, etext; \
<                      GC_noop(&end, &etext); }
---
> # ifdef __cplusplus
>       extern "C" {
> # endif
>         GC_API void GC_noop();
> # ifdef __cplusplus
>       }
> # endif
> #   define GC_INIT() { GC_noop(); }


If anyone has any insight, I would greatly appreciate anything
you have to offer.

Thanks very much,
John Plevyak (for my co-worker Brad Chamberlain)
-- 
John Bradley Plevyak, PhD,   jplevyak at acm.org,   PGP KeyID: 051130BD


More information about the Gc mailing list