Cross-Platform build scripts for audio plugins
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.6KB

  1. diff -Naur Python-3.8.0-orig/Modules/_ctypes/_ctypes.c Python-3.8.0/Modules/_ctypes/_ctypes.c
  2. --- Python-3.8.0-orig/Modules/_ctypes/_ctypes.c 2019-10-14 16:34:47.000000000 +0300
  3. +++ Python-3.8.0/Modules/_ctypes/_ctypes.c 2019-10-22 10:02:10.434865800 +0300
  4. @@ -3342,11 +3342,30 @@
  5. mangled_name = alloca(strlen(name) + 1 + 1 + 1 + 3); /* \0 _ @ %d */
  6. if (!mangled_name)
  7. return NULL;
  8. + /* Issue: for stdcall decorated export functions MSVC compiler adds
  9. + * underscore, but GCC compiler create them without. This is
  10. + * visible by example for _ctypes_test.pyd module.
  11. + * As well functions from system libraries are without underscore.
  12. + * Solutions:
  13. + * - If a python module is build with gcc option --add-stdcall-alias
  14. + * the module will contain XXX as alias for function XXX@ as result
  15. + * first search in this method will succeed.
  16. + * - Distutil may use compiler to create def-file, to modify it as
  17. + * add underscore alias and with new def file to create module.
  18. + * - Or may be just to search for function without underscore.
  19. + */
  20. for (i = 0; i < 32; ++i) {
  21. sprintf(mangled_name, "_%s@%d", name, i*4);
  22. Py_BEGIN_ALLOW_THREADS
  23. address = (PPROC)GetProcAddress(handle, mangled_name);
  24. Py_END_ALLOW_THREADS
  25. + if (address)
  26. + return address;
  27. + /* search for function without underscore as weel */
  28. + sprintf(mangled_name, "%s@%d", name, i*4);
  29. + Py_BEGIN_ALLOW_THREADS
  30. + address = (PPROC)GetProcAddress(handle, mangled_name);
  31. + Py_END_ALLOW_THREADS
  32. if (address)
  33. return address;
  34. }