Added DECL_GLOBAL_CONSTRUCTOR macro.

This commit is contained in:
Alexandre Julliard 2000-05-01 20:25:13 +00:00
parent 27337af65c
commit 1ca9be85f6
4 changed files with 22 additions and 30 deletions

View File

@ -190,13 +190,4 @@ ddraw_driver dga_driver = {
DGA_Create
};
#ifdef __GNUC__
static void DGA_register(void) __attribute__((constructor));
#else /* defined(__GNUC__) */
static void __asm__dummy_dll_init(void) {
asm("\t.section .init ,\"ax\"\n"
"\tcall DGA_register\n"
"\t.previous\n");
}
#endif /* defined(__GNUC__) */
static void DGA_register(void) { ddraw_register_driver(&dga_driver); }
DECL_GLOBAL_CONSTRUCTOR(DGA_register) { ddraw_register_driver(&dga_driver); }

View File

@ -182,13 +182,4 @@ ddraw_driver dga2_driver = {
DGA2_Create
};
#ifdef __GNUC__
static void DGA2_register(void) __attribute__((constructor));
#else /* defined(__GNUC__) */
static void __asm__dummy_dll_init(void) {
asm("\t.section .init ,\"ax\"\n"
"\tcall DGA2_register\n"
"\t.previous\n");
}
#endif /* defined(__GNUC__) */
static void DGA2_register(void) { ddraw_register_driver(&dga2_driver); }
DECL_GLOBAL_CONSTRUCTOR(DGA2_register) { ddraw_register_driver(&dga2_driver); }

View File

@ -105,13 +105,4 @@ ddraw_driver x11_driver = {
X11_Create
};
#ifdef __GNUC__
static void X11_register(void) __attribute__((constructor));
#else /* defined(__GNUC__) */
static void __asm__dummy_dll_init(void) {
asm("\t.section .init ,\"ax\"\n"
"\tcall X11_register\n"
"\t.previous\n");
}
#endif /* defined(__GNUC__) */
static void X11_register(void) { ddraw_register_driver(&x11_driver); }
DECL_GLOBAL_CONSTRUCTOR(X11_register) { ddraw_register_driver(&x11_driver); }

View File

@ -762,6 +762,25 @@ typedef HANDLE *PHANDLE;
# error You must define GET_IP for this CPU
#endif
/* Constructor functions */
#ifdef __GNUC__
# define DECL_GLOBAL_CONSTRUCTOR(func) \
static void func(void) __attribute__((constructor)); \
static void func(void)
#else /* __GNUC__ */
# ifdef __i386__
# define DECL_GLOBAL_CONSTRUCTOR(func) \
static void __dummy_init_##func(void) { \
asm(".section .init,\"ax\"\n\t" \
"call " #func "\n\t" \
".previous"); } \
static void func(void)
# else /* __i386__ */
# error You must define the DECL_GLOBAL_CONSTRUCTOR macro for your platform
# endif
#endif /* __GNUC__ */
#endif /* __WINE__ */
/*