1
0
forked from 0ad/0ad
0ad/source/lib/sysdep/win/delay_load.h
janwas b755ddefda remove all author/modified by tags.
make include guards consistent.

This was SVN commit r5040.
2007-05-07 16:33:24 +00:00

35 lines
940 B
C

/**
* =========================================================================
* File : delay_load.h
* Project : 0 A.D.
* Description : allow delay-loading DLLs.
* =========================================================================
*/
// license: GPL; see lib/license.txt
struct DllLoadNotify;
extern void wdll_add_notify(DllLoadNotify*);
// note: this mechanism relies on the compiler calling non-local static
// object ctors, which doesn't happen if compiling this code into
// a static library. recommended workaround is to call wdll_add_notify via
// win.cpp module init mechanism.
struct DllLoadNotify
{
const char* dll_name;
LibError (*func)(void);
DllLoadNotify* next;
DllLoadNotify(const char* _dll_name, LibError (*_func)(void))
{
dll_name = _dll_name;
func = _func;
wdll_add_notify(this);
}
};
#define WDLL_LOAD_NOTIFY(dll_name, func)\
static DllLoadNotify func##_NOTIFY(dll_name, func)