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.
#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>