[Gc] Dynamic lib support for GC on MacOSX

Andrew Begel abegel@eecs.berkeley.edu
Sat, 28 Jun 2003 15:11:05 -0700

Thank you very much. GC_init() did the trick. Question, is it dangerous 
to call GC_init() more than once? My app is in the form of dynamic 
libraries and bundles, with no main binary. Thus, I'd probably put this 
in the init routine for each dylib (passing -init my_init_function to 
ld), but I can't guarantee which dylib will get loaded first, so I'd 
have to put it in both.



On Saturday, June 28, 2003, at 02:45  PM, Brian Alliet wrote:

> On Saturday, June 28, 2003, at 05:14  PM, Andrew Begel wrote:
>> However, now I'm getting memory being freed before it's supposed to 
>> be. I have to track this down now (since it doesn't happen under 
>> Linux, nor under OSX with the gc turned off).
> Be sure you are building with --enable-shared (should be on by 
> default, but just in case) and --enable-threads (very important if you 
> are using threads). Also, you MUST call GC_init() before you call any 
> other gc functions. (see doc/README.darwin) You don't need to do this 
> on linux, but you do on OS X. Just throwing it in main() should do the 
> trick.
> -Brian

Andrew Begel
Ph.D. Candidate
Computer Science Division
University of California, Berkeley