Re: Fwd: [Gc] Boehm GC and static library

Ivan Maidanski ivmai at
Tue Jan 4 01:15:03 PST 2011

Hi Hans,

AICS, the problem was in that the client hasn't defined GC_THREADS (before gc.h inclussion).


Mon, 3 Jan 2011 21:37:38 +0000 "Boehm, Hans" <hans.boehm at>:

> Forwarding, since I'm not currently in a position to approve this.
> Hans
> From: Scott [mailto:theerickson at] 
> Sent: Monday, January 03, 2011 12:36 PM
> To: Bruce Hoult
> Cc: Randy Buck; gc at
> Subject: Re: [Gc] Boehm GC and static library
> The issue was resolved. #define GC_THREADS was mistakenly omitted. Thanks for replying Bruce!

> Scott

> On Tue, Dec 28, 2010 at 9:45 PM, Bruce Hoult <bruce at> wrote:
> On Fri, Dec 24, 2010 at 5:59 AM, Randy Buck <sutekistudent at> wrote:
> > I am having difficulty getting the Boehm GC to work with a static library.
> > I get the following error: "Collecting from unknown thread."
> > The static library creates a thread and listens for UDP packets coming into
> > it. If I do not create this thread, everything works fine, meaning it
> > compiles and runs but doesn't perform the necessary functionality. I am
> > guessing that this is the thread in reference to the above error message.
> > How do I use the GC when I am linking in a static library that creates
> > threads?
> You didn't say what operating system you are on. You may have to call
> GC_register_my_thread() at the start of your thread, something like
> this:

> struct GC_stack_base *sb;
> GC_get_stack_base(&sb);
> GC_register_my_thread(&sb);

> Is someone calling gcinit()?
>   _______________________________________________
> Gc mailing list
> Gc at

More information about the Gc mailing list