Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(19)

Unified Diff: Modules/_ctypes/_ctypes.c

Issue 3871: cross and native build of python for mingw32 with distutils
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_sysconfig.py ('k') | Modules/_ctypes/libffi_msvc/win32.S » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Modules/_ctypes/_ctypes.c Thu Dec 27 23:52:36 2012 +0200
+++ b/Modules/_ctypes/_ctypes.c Thu Dec 27 17:35:12 2012 -0500
@@ -3056,11 +3056,27 @@
mangled_name = alloca(strlen(name) + 1 + 1 + 1 + 3); /* \0 _ @ %d */
if (!mangled_name)
return NULL;
+ /* FIXME: for stdcall decorated export functions MSVC compiler add
+ * underscore, but GCC compiler create them without.
+ * As well functions from system libraries are without underscore.
+ * This is visible by example for _ctypes_test.pyd module.
+ * Solutions:
+ * - If a python module is build with gcc option --add-stdcall-alias
+ * the module will contain XXX as alias for function XXX@ as result
+ * first search in this method will succeed.
+ * - Distutil may use compiler to create def-file, to modify it as
+ * add underscore alias and with new def file to create module.
+ * - Or may be just to search for function without underscore.
+ */
for (i = 0; i < 32; ++i) {
sprintf(mangled_name, "_%s@%d", name, i*4);
address = (PPROC)GetProcAddress(handle, mangled_name);
if (address)
return address;
+ sprintf(mangled_name, "%s@%d", name, i*4);
+ address = (PPROC)GetProcAddress(handle, mangled_name);
+ if (address)
+ return address;
}
return NULL;
#endif
« no previous file with comments | « Lib/test/test_sysconfig.py ('k') | Modules/_ctypes/libffi_msvc/win32.S » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+