Skip to content

Commit 2dab31f

Browse files
committed
mpiimporter
1 parent 0fbac6b commit 2dab31f

File tree

8 files changed

+3988
-0
lines changed

8 files changed

+3988
-0
lines changed

Makefile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ libminimal_thefunc.so: minimal_thefunc.o
2121
libthefunc.so : thefunc.o
2222
${CC} -shared -g3 -fPIC -o $@ $^
2323

24+
importer.o: importer.c
25+
$(MPICC) ${CFLAGS} -I. ${PYTHON_CFLAGS} -c importer.c -o importer.o
26+
27+
mpiopen.o: mpiopen.c
28+
$(MPICC) ${CFLAGS} -c mpiopen.c -o mpiopen.o
29+
30+
mpiimporter.so: mpiopen.o importer.o
31+
$(MPICC) ${CFLAGS} -shared ${PYTHON_LDFLAGS} mpiopen.o importer.o -o mpiimporter.so
32+
2433
minimal_main : minimal_main.o libminimal_thefunc.so
2534
${MPICC} -g3 -o $@ minimal_main.o ${LDFLAGS}
2635

importdl.h

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#ifndef Py_IMPORTDL_H
2+
#define Py_IMPORTDL_H
3+
4+
#ifdef __cplusplus
5+
extern "C" {
6+
#endif
7+
8+
9+
/* Definitions for dynamic loading of extension modules */
10+
enum filetype {
11+
SEARCH_ERROR,
12+
PY_SOURCE,
13+
PY_COMPILED,
14+
C_EXTENSION,
15+
PY_RESOURCE, /* Mac only */
16+
PKG_DIRECTORY,
17+
C_BUILTIN,
18+
PY_FROZEN,
19+
PY_CODERESOURCE, /* Mac only */
20+
IMP_HOOK
21+
};
22+
23+
struct filedescr {
24+
char *suffix;
25+
char *mode;
26+
enum filetype type;
27+
};
28+
extern struct filedescr * _PyImport_Filetab;
29+
extern const struct filedescr _PyImport_DynLoadFiletab[];
30+
31+
extern PyObject *_PyImport_LoadDynamicModule(char *name, char *pathname,
32+
FILE *);
33+
34+
/* Max length of module suffix searched for -- accommodates "module.slb" */
35+
#define MAXSUFFIXSIZE 12
36+
37+
#ifdef MS_WINDOWS
38+
#include <windows.h>
39+
typedef FARPROC dl_funcptr;
40+
#else
41+
#if defined(PYOS_OS2) && !defined(PYCC_GCC)
42+
#include <os2def.h>
43+
typedef int (* APIENTRY dl_funcptr)();
44+
#else
45+
typedef void (*dl_funcptr)(void);
46+
#endif
47+
#endif
48+
49+
50+
#ifdef __cplusplus
51+
}
52+
#endif
53+
#endif /* !Py_IMPORTDL_H */

0 commit comments

Comments
 (0)