Commit 1a145bb5 authored by Francois Gouget's avatar Francois Gouget Committed by Alexandre Julliard

msvcrt/tests: We cannot link with _initterm() with Visual C++, so we have to load it dynamically.

parent 89bb5460
......@@ -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();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment