This is the mail archive of the
pthreads-win32@sourceware.org
mailing list for the pthreas-win32 project.
Static libraries initialization
- From: Ramiro Polla <ramiro at lisha dot ufsc dot br>
- To: pthreads-win32 at sourceware dot org
- Date: Thu, 24 Apr 2008 13:53:02 +0100
- Subject: Static libraries initialization
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