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

Side by Side 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
Left:
Right:
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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ToDo: 2 ToDo:
3 3
4 Get rid of the checker (and also the converters) field in PyCFuncPtrObject and 4 Get rid of the checker (and also the converters) field in PyCFuncPtrObject and
5 StgDictObject, and replace them by slot functions in StgDictObject. 5 StgDictObject, and replace them by slot functions in StgDictObject.
6 6
7 think about a buffer-like object (memory? bytes?) 7 think about a buffer-like object (memory? bytes?)
8 8
9 Should POINTER(c_char) and POINTER(c_wchar) have a .value property? 9 Should POINTER(c_char) and POINTER(c_wchar) have a .value property?
10 What about c_char and c_wchar arrays then? 10 What about c_char and c_wchar arrays then?
(...skipping 3038 matching lines...) Expand 10 before | Expand all | Expand 10 after
3049 if (dict==NULL || dict->flags & FUNCFLAG_CDECL) 3049 if (dict==NULL || dict->flags & FUNCFLAG_CDECL)
3050 return address; 3050 return address;
3051 3051
3052 /* for stdcall, try mangled names: 3052 /* for stdcall, try mangled names:
3053 funcname -> _funcname@<n> 3053 funcname -> _funcname@<n>
3054 where n is 0, 4, 8, 12, ..., 128 3054 where n is 0, 4, 8, 12, ..., 128
3055 */ 3055 */
3056 mangled_name = alloca(strlen(name) + 1 + 1 + 1 + 3); /* \0 _ @ %d */ 3056 mangled_name = alloca(strlen(name) + 1 + 1 + 1 + 3); /* \0 _ @ %d */
3057 if (!mangled_name) 3057 if (!mangled_name)
3058 return NULL; 3058 return NULL;
3059 /* FIXME: for stdcall decorated export functions MSVC compiler add
3060 * underscore, but GCC compiler create them without.
3061 * As well functions from system libraries are without underscore.
3062 * This is visible by example for _ctypes_test.pyd module.
3063 * Solutions:
3064 * - If a python module is build with gcc option --add-stdcall-alias
3065 * the module will contain XXX as alias for function XXX@ as result
3066 * first search in this method will succeed.
3067 * - Distutil may use compiler to create def-file, to modify it as
3068 * add underscore alias and with new def file to create module.
3069 * - Or may be just to search for function without underscore.
3070 */
3059 for (i = 0; i < 32; ++i) { 3071 for (i = 0; i < 32; ++i) {
3060 sprintf(mangled_name, "_%s@%d", name, i*4); 3072 sprintf(mangled_name, "_%s@%d", name, i*4);
3073 address = (PPROC)GetProcAddress(handle, mangled_name);
3074 if (address)
3075 return address;
3076 sprintf(mangled_name, "%s@%d", name, i*4);
3061 address = (PPROC)GetProcAddress(handle, mangled_name); 3077 address = (PPROC)GetProcAddress(handle, mangled_name);
3062 if (address) 3078 if (address)
3063 return address; 3079 return address;
3064 } 3080 }
3065 return NULL; 3081 return NULL;
3066 #endif 3082 #endif
3067 } 3083 }
3068 #endif 3084 #endif
3069 3085
3070 /* Return 1 if usable, 0 else and exception set. */ 3086 /* Return 1 if usable, 0 else and exception set. */
(...skipping 2363 matching lines...) Expand 10 before | Expand all | Expand 10 after
5434 PyModule_AddObject(m, "ArgumentError", PyExc_ArgError); 5450 PyModule_AddObject(m, "ArgumentError", PyExc_ArgError);
5435 } 5451 }
5436 return m; 5452 return m;
5437 } 5453 }
5438 5454
5439 /* 5455 /*
5440 Local Variables: 5456 Local Variables:
5441 compile-command: "cd .. && python setup.py -q build -g && python setup.py -q bu ild install --home ~" 5457 compile-command: "cd .. && python setup.py -q build -g && python setup.py -q bu ild install --home ~"
5442 End: 5458 End:
5443 */ 5459 */
OLDNEW
« 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+