summaryrefslogtreecommitdiff
path: root/win32/win32.h
diff options
context:
space:
mode:
authorJan Dubois <jand@activestate.com>2010-10-18 15:56:04 -0700
committerJan Dubois <jand@activestate.com>2010-10-18 15:57:33 -0700
commit50fd59617d035069f1af09e538c403b3e05768b3 (patch)
tree464c8abb9e1e4566b7fb0aaca7328564a31b5833 /win32/win32.h
parent108cd9378f43400cd4512da34871a49893a6f53d (diff)
downloadperl-50fd59617d035069f1af09e538c403b3e05768b3.tar.gz
Don't use "dllimport" for code in perl5xx.dll
This makes a difference for extensions that are "statically" linked into the Perl library, like DynaLoader and Win32CORE. The MinGW compiler/linker cannot resolve symbols that have been annotated as "dllimport" but are actually defined inside the same library. An exception is needed for the ext/re extension, which redefines core APIs internally, so these functions must not be marked as "dllimport" either. This commit is a fix/enhancement to commit ad6ab6c5.
Diffstat (limited to 'win32/win32.h')
-rw-r--r--win32/win32.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/win32/win32.h b/win32/win32.h
index a7e3e12e5e..c8fd49373a 100644
--- a/win32/win32.h
+++ b/win32/win32.h
@@ -55,7 +55,16 @@
#define DllExport __declspec(dllimport)
#endif
-#ifndef PERL_CORE
+/* The Perl APIs can only be called directly inside the perl5xx.dll.
+ * All other code has to import them. By declaring them as "dllimport"
+ * we tell the compiler to generate an indirect call instruction and
+ * avoid redirection through a call thunk.
+ *
+ * The XS code in the re extension is special, in that it redefines
+ * core APIs locally, so don't mark them as "dllimport" because GCC
+ * cannot handle this situation.
+ */
+#if !defined(PERLDLL) && !defined(PERL_EXT_RE_BUILD)
# ifdef __cplusplus
# define PERL_CALLCONV extern "C" __declspec(dllimport)
# else