Skip to content

Commit

Permalink
Use PyMODINIT_FUNC for module init functions
Browse files Browse the repository at this point in the history
This is the correct way to define init functions
and allows greenlet to pick up any platform
specific external linkage attributes, including
extern "C" when compiled as C++ code.
  • Loading branch information
snaury committed Dec 20, 2011
1 parent 402ad49 commit d8c51d9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions greenlet.c
Original file line number Diff line number Diff line change
Expand Up @@ -1265,12 +1265,13 @@ static struct PyModuleDef greenlet_module_def = {
GreenMethods,
};

PyObject *
PyMODINIT_FUNC
PyInit_greenlet(void)
#else
#define INITERROR return

void initgreenlet(void)
PyMODINIT_FUNC
initgreenlet(void)
#endif
{
PyObject* m = NULL;
Expand Down
2 changes: 1 addition & 1 deletion tests/_test_extension.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ static struct PyModuleDef moduledef = {
NULL
};

PyObject *
PyMODINIT_FUNC
PyInit__test_extension(void)
#else
#define INITERROR return
Expand Down

0 comments on commit d8c51d9

Please sign in to comment.