I think I have a kind of chicken-egg problem:
I have a library (dll) that is pure C and that is supposed to be thread-safe.
How do I initialize it? I mean, at some point I need to call
globalMutex=CreateMutex(0,FALSE,0); do some other initializations here
The above section of code should be run only the very first time someone calls a function in the library. But what if several threads call the library at the same time? Best would be to have a mutex to make sure the initialization happens only once, but mutexes need to be initialized...