PATCH: Fix DLL constructors on OpenBSD

Alexandre Julliard julliard at
Sat Jan 3 12:07:56 CST 2004

wiml at (Wim Lewis) writes:

> There *is* a section named .init, but any code placed there will
> be linked after the C function __init() in crtbeginS.c, and will not be
> executed because that C function returns normally. But the only
> thing that __init() does is invoke the functions pointed to
> by .ctors, and add a hook to make sure that the .dtors are called.

The way it normally works is that the _init() function is built from
the contents of the .init section, so if you add code in .init it's
supposed to show up in _init(). Then the C run time adds code in .init
that calls the constructors. So there are two separate mechanisms, and
the constructors are built on top of the .init stuff. In our case we
need to be in .init because the constructors are normally called after
the rest of the .init code.

Alexandre Julliard
julliard at

More information about the wine-devel mailing list