[Gc] Usage of gc 6.3 in VS6

Boehm, Hans hans.boehm at hp.com
Fri Feb 18 18:04:10 PST 2005


I'm not enough of a Windows linker expert to tell you whether this
matters or whether it's easy to fix.

The basic problem is that gc_cpp.[hc] try to replace the global ::new
operator, so that it allocates uncollectable, but traceable memory.
This ensures that collectable objects referenced from uncollectable ones
will be seen as reachable by the collector, and hence won't be reclaimed
prematurely.

Unfortunately, it seems to be very hard to do this portably in C++.
The particular code you mentioned declares a weird VC++-only
version of the new operator which is used for debug builds,
presumably so that line number information can be included.
Although nonstandard, it also needs to be replaced, and we try ...

So long as you can somehow arrange that all ::new calls go through
one of these functions, which all basically do the same thing,
you should be fine.

Hans

> -----Original Message-----
> From: gc-bounces at napali.hpl.hp.com 
> [mailto:gc-bounces at napali.hpl.hp.com] On Behalf Of Lutz Feldgen
> Sent: Wednesday, February 16, 2005 6:11 AM
> To: gc at napali.hpl.hp.com
> Subject: [Gc] Usage of gc 6.3 in VS6
> 
> 
> Hi,
> 
> I am trying to include gc to my application written in C++ 
> with Visual Studio 6.
> 
> I compiled gc with "nmake" in Windows with NT_MAKEFILE, added 
> the resulting gc.lib and most of the headers to my project.
> 
> Unfortunately the VS6 compiler in debug mode complains about
> 
> warning C4273: 'new' : inconsistent dll linkage.  dllexport assumed.
> 
> This warning points to gc_cpp.h
> 
>  // This new operator is used by VC++ in case of Debug builds !
>  void* operator new(  size_t size,
> 		      int ,//nBlockUse,
> 		      const char * szFileName,
> 		      int nLine );
> 
> But there is also a
> 
>  void *operator new[]( size_t size );
> 
> My code which calls the "new" is:
> 
> 	int number = 10;
> 	PCCERT_CONTEXT p_certificateArray = new PCCERT_CONTEXT[number];
> 
> What is going wrong here?
> 
> Any help is appreciated!
> 
> Lutz Feldgen
> 
> _______________________________________________
> Gc mailing list
> Gc at linux.hpl.hp.com 
> http://www.hpl.hp.com/hosted/linux/mail-archives/gc/
> 


More information about the Gc mailing list