[Gc] Boehm GC and static library

Bruce Hoult bruce at hoult.org
Tue Dec 28 20:45:15 PST 2010


On Fri, Dec 24, 2010 at 5:59 AM, Randy Buck <sutekistudent at gmail.com> 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()?



More information about the Gc mailing list