Static libraries initialization

Ramiro Polla ramiro@lisha.ufsc.br
Thu Apr 24 12:53:00 GMT 2008


Hello,

pthreads-win32 requires programs that use the library statically to call 
some (de)initialization code, which would be the same code called by 
DllMain(). There are plenty of messages regarding this on the mailinglist.

This makes the library not very developer friendly. It causes code 
duplication for every program that wants to use the library statically, 
#ifdef mess and harder configuration checks.

1- Why isn't this initialization done by pthreads-win32 itself? All
    pthread_* functions could have an if(!initialized) {...} block before
    running any code that depends on it.
2- Static pthreads-win32 libraries should at least check if they were
    properly initialized before allowing pthread_* functions to run.
    Returning an error is far better than having the program crash.

Ramiro Polla



More information about the Pthreads-win32 mailing list