diff --git a/dlls/msvcrt/iob.c b/dlls/msvcrt/iob.c index a499f19309e..4d8456867a8 100644 --- a/dlls/msvcrt/iob.c +++ b/dlls/msvcrt/iob.c @@ -24,6 +24,7 @@ #endif #include +#include #undef __iob_func extern FILE * __cdecl __iob_func(void); @@ -35,9 +36,4 @@ FILE * __cdecl __acrt_iob_func(unsigned idx) { return __iob_func() + idx; } - -#ifdef __i386__ -void *_imp____acrt_iob_func = __acrt_iob_func; -#else -void *__imp___acrt_iob_func = __acrt_iob_func; -#endif +__ASM_GLOBAL_IMPORT(__acrt_iob_func) diff --git a/include/wine/asm.h b/include/wine/asm.h index 2d1607ca772..b4b6fb50eb8 100644 --- a/include/wine/asm.h +++ b/include/wine/asm.h @@ -83,6 +83,28 @@ #define __ASM_STDCALL_FUNC(name,args,code) __ASM_DEFINE_FUNC(__ASM_STDCALL(#name,args),code) #define __ASM_FASTCALL_FUNC(name,args,code) __ASM_DEFINE_FUNC(__ASM_FASTCALL(#name,args),code) +/* import variables */ + +#ifdef _WIN64 +#define __ASM_DEFINE_IMPORT(name) \ + __ASM_BLOCK_BEGIN(__LINE__) \ + asm(".data\n\t.balign 8\n\t.globl __imp_" name "\n__imp_" name ":\n\t.quad " name "\n\t.text"); \ + __ASM_BLOCK_END +#else +#define __ASM_DEFINE_IMPORT(name) \ + __ASM_BLOCK_BEGIN(__LINE__) \ + asm(".data\n\t.balign 4\n\t.globl __imp_" name "\n__imp_" name ":\n\t.long " name "\n\t.text"); \ + __ASM_BLOCK_END +#endif + +#ifdef _WIN32 +#define __ASM_GLOBAL_IMPORT(name) __ASM_DEFINE_IMPORT(__ASM_NAME(#name)) +#define __ASM_STDCALL_IMPORT(name,args) __ASM_DEFINE_IMPORT(__ASM_STDCALL(#name,args)) +#else +#define __ASM_GLOBAL_IMPORT(name) /* nothing */ +#define __ASM_STDCALL_IMPORT(name,args) /* nothing */ +#endif + /* fastcall support */ #if defined(__i386__) && !defined(_WIN32)