Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: weird bug: dylib symbol loading hangs on pthread semaphore



On Friday, December 20, 2002, at 09:50 AM, Yarden Livnat wrote:

Greetings,


Brief intro:

The set up:
1) three small c++ files. see bellow
2) c++ -dynamiclib -o libfoo.dylib a.o b.o c.o
3) a small program (attached)
lib = dlopen( "libfoo.dylib", RTLD_LAZY | RTLD_GLOBAL);
dlsym( lib, symbol_name);

The Problem:
dlsym hangs. gdb reveal the program is waiting on
#0 0x90034d68 in semaphore_wait_trap ()
#1 0x9000a258 in pthread_mutex_lock ()

It's a known bug, and we consider it to be important. We intend
to fix it in the next release. It's a bad interaction between
lazy binding and initialization of file scope objects.

As a short-term workaround, add this shared library init routine:
oft_init() { _ZNSt8ios_base4InitC4Ev(); }
Put this in an object file of its own, link that object file into the
library, then link with the option "-init _oft_init".

--Matt
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.

References: 
 >weird bug: dylib symbol loading hangs on pthread semaphore (From: Yarden Livnat <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.