mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 06:30:37 +00:00
msvcrt/tests: We cannot link with _initterm() with Visual C++, so we have to load it dynamically.
This commit is contained in:
parent
89bb54601f
commit
1a145bb532
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user