libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] libmicrohttpd-0.4.4 on Windows


From: Michael Lenaghan
Subject: [libmicrohttpd] libmicrohttpd-0.4.4 on Windows
Date: Wed, 6 Jan 2010 00:09:26 -0500

Has anyone successfully used the new Windows binaries that were posted
in Dec? My exe is hanging before it even gets to main(). That makes it
look like a DLL initialization problem.

Does anyone know when this would be called on Windows?

void __attribute__ ((constructor)) MHD_init ();

I'm hoping it won't be called by DllMain. According to Microsoft:

"The entry-point function should perform only simple initialization or
termination tasks. It must not call the LoadLibrary or LoadLibraryEx
function (or a function that calls these functions), because this may
create dependency loops in the DLL load order. This can result in a
DLL being used before the system has executed its initialization
code."

and:

"Calling functions that require DLLs other than Kernel32.dll may
result in problems that are difficult to diagnose. For example,
calling User, Shell, and COM functions can cause access violation
errors, because some functions load other system components.
Conversely, calling functions such as these during termination can
cause access violation errors because the corresponding component may
already have been unloaded or uninitialized."

http://msdn.microsoft.com/en-us/library/ms682583(VS.85).aspx

Currently MHD_init() calls plibc_init() and pthread_mutex_init();
plibc_init() initializes both WinSock and COM. *If* constructors are
called by DllMain, that would all be bad news. And if no one knows
when they get called, it might be safer to make them regular routines
on Windows and require users to call them at the appropriate time.

(Btw: I'm using plibc 0.1.5 from the plibc site.)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]