[Gc] C++ Linkage not working on Windows XP

Matthew Bromberg mattcbro at earthlink.net
Fri Mar 14 10:34:41 PST 2008

It's either that or I'm doing something terribly wrong.  First I did not 
see any way to add compile flags to add C++ capability.
The install instructions implied that all I needed was to include 
gc_cpp.h.  For gc-7.0  I was able to build it using MS Visual Studio C++ 8.0
(their latest express edition as of march 2008).  Remarkably gctest runs 
and reports no errors, but that is a C program isn't it (test.c)?

I placed the following simple program into the Release directory:


#include <iostream>
#include <../include/gc_cpp.h>

using namespace std ;

int main()
cout << "Calling the GC initializer" << endl ;
GC_init() ;

cout << "getting some memory" << endl ;

char *ch = new (GC) char[64] ;
// char *ch = new char[64] ;
ch[0] = 'O' ; ch[1] = 'K' ; ch[2] = 0 ;

cout << "It seems to be " << ch << endl ;

Calling cpptest.exe  fails  during execution with a statement that it 
can't find  the C runtime library MSVCR90.dll.  Add this library to the 
path introduces some new dll loading errors later on.  Removing calls to 
the GC engine makes this error go away.  Hence there is something odd 
with the gc build.  This build should be the threaded win32 version. Not 
surprising other C++ compilers report the same issue when linking to 
this library.  Now my version 6.6 of gc built with the venerable non 
standards compliant MS VC++ 6.0 works just fine with this code.  This 
suggests to me that something needs to be changed in order to properly 
support the newer compilers on windows.  Since right now we are in a 
state that  the newer SDKs and MS VC++ 6.0 compilers will not compile 
(v7.0) of the garbage collector and apparently something's not quite 
right with the MS VS C++ 2008 build.  I think it has something to do 
with embedding the correct manifests into the library.  It seems to be 
an extra linking stage that's now required.


More information about the Gc mailing list