miniperl.exe does not load XS modules. It has no reason to export anything.
About 130 things are exported by VC Win32 miniperl. 90% of them are
the win32_* functions. All but a couple Perl_* exports are gone in the
exporting miniperl. See perl #115216 for the full list of accidentally
exported items. Also stop trying to find Win32CORE's boot function in
Perl_init_os_extras through the export table. It is not exported and not
in the miniperl image and GetProcAddress will never return not NULL. By
removing this GetProcAddress call, miniperl stops importing GetProcAddress
from kernel32 and a tiny bit startup time by miniperl during the full
perl build process. By removing the exports the compiler is free to use
more random (not cdecl) calling conventions and/or optimizing away code
than before. Also by removing the export entries, and the GetProcAddress
import, RO strings are removed from the miniperl image. This commit only
affects the VC miniperl. The Mingw miniperl remains unmodified except
for not trying to load Win32CORE through the export table and some of the
.c files being compiled with PERL_IS_MINIPERL when previously they were
not.
# define dEXTCONST globaldef {"$GLOBAL_RO_VARS"} readonly
#else
# if (defined(WIN32) || defined(__SYMBIAN32__)) && !defined(PERL_STATIC_SYMS)
-# if defined(PERLDLL) || defined(__SYMBIAN32__)
-# define EXT extern __declspec(dllexport)
+/* miniperl should not export anything */
+# if defined(PERL_IS_MINIPERL) && !defined(UNDER_CE) && defined(_MSC_VER)
+# define EXT extern
# define dEXT
-# define EXTCONST extern __declspec(dllexport) const
+# define EXTCONST extern const
# define dEXTCONST const
# else
-# define EXT extern __declspec(dllimport)
-# define dEXT
-# define EXTCONST extern __declspec(dllimport) const
-# define dEXTCONST const
+# if defined(PERLDLL) || defined(__SYMBIAN32__)
+# define EXT extern __declspec(dllexport)
+# define dEXT
+# define EXTCONST extern __declspec(dllexport) const
+# define dEXTCONST const
+# else
+# define EXT extern __declspec(dllimport)
+# define dEXT
+# define EXTCONST extern __declspec(dllimport) const
+# define dEXTCONST const
+# endif
# endif
# else
# if defined(__CYGWIN__) && defined(USEIMPORTLIB)
$(CC) -c $(CFLAGS) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ ..\$(*F).c
$(MINIWIN32_OBJ) : $(CORE_NOCFG_H)
- $(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ $(*F).c
+ $(CC) -c $(CFLAGS) -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(*F).c
# -DPERL_IMPLICIT_SYS needs C++ for perllib.c
# This is the only file that depends on perlhost.h, vmem.h, and vdir.h
$(CC) -c $(CFLAGS) -DPERL_EXTERNAL_GLOB -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ ..\$(*B).c
$(MINIWIN32_OBJ) : $(CORE_NOCFG_H)
- $(CC) -c $(CFLAGS) $(OBJOUT_FLAG)$@ $(*B).c
+ $(CC) -c $(CFLAGS) -DPERL_IS_MINIPERL $(OBJOUT_FLAG)$@ $(*B).c
# -DPERL_IMPLICIT_SYS needs C++ for perllib.c
# rules wrapped in .IFs break Win9X build (we end up with unbalanced []s unless
char *file = __FILE__;
/* Initialize Win32CORE if it has been statically linked. */
+#ifndef PERL_IS_MINIPERL
void (*pfn_init)(pTHX);
pfn_init = (void (*)(pTHX))GetProcAddress((HMODULE)w32_perldll_handle, "init_Win32CORE");
if (pfn_init)
pfn_init(aTHX);
+#endif
newXS("Win32::SetChildShowWindow", w32_SetChildShowWindow, file);
}
*/
/* now even GCC supports __declspec() */
-
-#if defined(PERLDLL)
-#define DllExport __declspec(dllexport)
+/* miniperl has no reason to export anything */
+#if defined(PERL_IS_MINIPERL) && !defined(UNDER_CE) && defined(_MSC_VER)
+# define DllExport
#else
-#define DllExport __declspec(dllimport)
+# if defined(PERLDLL)
+# define DllExport __declspec(dllexport)
+# else
+# define DllExport __declspec(dllimport)
+# endif
#endif
/* The Perl APIs can only be called directly inside the perl5xx.dll.