Francois Gouget : msvcrt/tests: We cannot link with _initterm() with Visual C++, so we have to load it dynamically.
Module: wine Branch: master Commit: 1a145bb53225d4dc5efc8e5964f4be1e8499fd7f URL: http://source.winehq.org/git/wine.git/?a=commit;h=1a145bb53225d4dc5efc8e5964... Author: Francois Gouget <fgouget(a)free.fr> Date: Thu Nov 23 21:38:51 2006 +0100 msvcrt/tests: We cannot link with _initterm() with Visual C++, so we have to load it dynamically. --- dlls/msvcrt/tests/data.c | 13 +++++++++++-- 1 files changed, 11 insertions(+), 2 deletions(-) diff --git a/dlls/msvcrt/tests/data.c b/dlls/msvcrt/tests/data.c index b13d722..74980a2 100644 --- a/dlls/msvcrt/tests/data.c +++ b/dlls/msvcrt/tests/data.c @@ -32,7 +32,7 @@ #include <errno.h> typedef void (*_INITTERMFUN)(void); -extern unsigned int CDECL _initterm(_INITTERMFUN *start,_INITTERMFUN *end); +static unsigned int (*p_initterm)(_INITTERMFUN *start, _INITTERMFUN *end); static int callbacked; @@ -43,7 +43,7 @@ void initcallback(void) #define initterm_test(start, end, expected) \ callbacked = 0; \ - rc = _initterm(start, end); \ + rc = p_initterm(start, end); \ ok(expected == rc, "_initterm: return result mismatch: got %i, expected %i\n", rc, expected); \ ok(expected == callbacked,"_initterm: callbacks count mismatch: got %i, expected %i\n", callbacked, expected); @@ -53,6 +53,9 @@ void test_initterm(void) int rc; static _INITTERMFUN callbacks[4]; + if (!p_initterm) + return; + for (i = 0; i < 4; i++) { callbacks[i] = initcallback; @@ -68,5 +71,11 @@ void test_initterm(void) START_TEST(data) { + HMODULE hmsvcrt; + hmsvcrt = GetModuleHandleA("msvcrt.dll"); + if (!hmsvcrt) + hmsvcrt = GetModuleHandleA("msvcrtd.dll"); + if (hmsvcrt) + p_initterm=(void*)GetProcAddress(hmsvcrt, "_initterm"); test_initterm(); }
participants (1)
-
Alexandre Julliard