Martijn van Duren wrote:
> Could you inform me on the preferred way for making a library thread safe?
> - always linking in lpthread into the library (which causes some extra 
> bloat in the loading of the extra library).
> - making the required symbols available via weak symbols, as per my 
> original question. (which might not be very portable and might make the 
> code less transparent)
> - making custom functions which load in the required symbols via dlsym 
> (which requires extra LoC)
> - another method I haven't thought of?

The second option is probably the best approach today. There are some annoying
downsides to linking directly against libpthread, since it then requires every
application to do the same. Using dlsym doesn't seem much much better than
using weak symbols.

Reply via email to