diff options
author | Jan Dubois <jand@activestate.com> | 2010-10-15 14:48:38 -0700 |
---|---|---|
committer | Jan Dubois <jand@activestate.com> | 2010-10-15 14:48:38 -0700 |
commit | ad6ab6c50584b455ffb6a48d18fb6409bea8a3c1 (patch) | |
tree | 65b1d536b9afb812b16e575d3a3754433ebb3bd8 /win32 | |
parent | 5f286eeea1a6d97101ebc9f6d579ca42c99e6711 (diff) | |
download | perl-ad6ab6c50584b455ffb6a48d18fb6409bea8a3c1.tar.gz |
Use __declspec(dllimport) for XS code on Windows
By default C compilers will generate direct call instructions that the
linker will have to route trhough a call thunk if the call site is not
available at link time. By annotating all imported symbols the compiler
is able to generate a indirect call instruction directly.
This should improve performance minimally, but will also make sure the
Perl API functions have the same addresses inside the core and inside
XS modules. The ext/XS-APItest/t/call_checker.t tests rely on being able
to compare function addresses.
Diffstat (limited to 'win32')
-rw-r--r-- | win32/win32.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/win32/win32.h b/win32/win32.h index 762ab54068..a7e3e12e5e 100644 --- a/win32/win32.h +++ b/win32/win32.h @@ -55,6 +55,14 @@ #define DllExport __declspec(dllimport) #endif +#ifndef PERL_CORE +# ifdef __cplusplus +# define PERL_CALLCONV extern "C" __declspec(dllimport) +# else +# define PERL_CALLCONV __declspec(dllimport) +# endif +#endif + #define WIN32_LEAN_AND_MEAN #include <windows.h> |