@@ -14,6 +14,34 @@ extern "C" {
1414
1515extern const char * _PyImport_DynLoadFiletab [];
1616
17+ #ifdef HAVE_DYNAMIC_LOADING
18+ /* ./configure sets HAVE_DYNAMIC_LOADING if dynamic loading of modules is
19+ supported on this platform. configure will then compile and link in one
20+ of the dynload_*.c files, as appropriate. We will call a function in
21+ those modules to get a function pointer to the module's init function.
22+
23+ The function should return:
24+ - The function pointer on success
25+ - NULL with exception set if the library cannot be loaded
26+ - NULL *without* an extension set if the library could be loaded but the
27+ function cannot be found in it.
28+ */
29+ #ifdef MS_WINDOWS
30+ #include <windows.h>
31+ typedef FARPROC dl_funcptr ;
32+ extern dl_funcptr _PyImport_FindSharedFuncptrWindows (const char * prefix ,
33+ const char * shortname ,
34+ PyObject * pathname ,
35+ FILE * fp );
36+ #else
37+ typedef void (* dl_funcptr )(void );
38+ extern dl_funcptr _PyImport_FindSharedFuncptr (const char * prefix ,
39+ const char * shortname ,
40+ const char * pathname , FILE * fp );
41+ #endif
42+
43+ #endif /* HAVE_DYNAMIC_LOADING */
44+
1745
1846typedef enum ext_module_kind {
1947 _Py_ext_module_kind_UNKNOWN = 0 ,
@@ -112,8 +140,6 @@ extern int _PyImport_RunModInitFunc(
112140#define MAXSUFFIXSIZE 12
113141
114142#ifdef MS_WINDOWS
115- #include <windows.h>
116- typedef FARPROC dl_funcptr ;
117143
118144#ifdef Py_DEBUG
119145# define PYD_DEBUG_SUFFIX "_d"
@@ -136,8 +162,6 @@ typedef FARPROC dl_funcptr;
136162#define PYD_TAGGED_SUFFIX PYD_DEBUG_SUFFIX "." PYD_SOABI ".pyd"
137163#define PYD_UNTAGGED_SUFFIX PYD_DEBUG_SUFFIX ".pyd"
138164
139- #else
140- typedef void (* dl_funcptr )(void );
141165#endif
142166
143167
0 commit comments