Commit fe94b2f5 authored by Stefan Behnel's avatar Stefan Behnel

Move CYTHON_NO_PYINIT_EXPORT utility code into external file to avoid lengthy...

Move CYTHON_NO_PYINIT_EXPORT utility code into external file to avoid lengthy chain of plain text code generation.
parent 10120c42
......@@ -2255,32 +2255,13 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("return -1;")
code.putln("}")
code.putln("")
code.putln(UtilityCode.load_cached("ImportStar", "ImportExport.c").impl)
code.putln(UtilityCode.load_as_string("ImportStar", "ImportExport.c")[1])
code.exit_cfunc_scope() # done with labels
def generate_module_init_func(self, imported_modules, env, code):
code.enter_cfunc_scope(self.scope)
code.putln("")
code.putln("#if PY_MAJOR_VERSION < 3")
code.putln("#ifdef CYTHON_NO_PYINIT_EXPORT")
code.putln("/* define this to void manually because PyMODINIT_FUNC")
code.putln("* adds __declspec(dllexport) to it's definition.")
code.putln("*/")
code.putln("#define __Pyx_PyMODINIT_FUNC void")
code.putln("#else")
code.putln("#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC")
code.putln("#endif")
code.putln("#else")
code.putln("#ifdef CYTHON_NO_PYINIT_EXPORT")
code.putln("/* define this to PyObject * manually because PyMODINIT_FUNC")
code.putln("* adds __declspec(dllexport) to it's definition.")
code.putln("*/")
code.putln("#define __Pyx_PyMODINIT_FUNC PyObject *")
code.putln("#else")
code.putln("#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC")
code.putln("#endif")
code.putln("#endif")
code.putln("")
code.putln(UtilityCode.load_as_string("PyModInitFuncType", "ModuleSetupCode.c")[0])
header2 = "__Pyx_PyMODINIT_FUNC init%s(void)" % env.module_name
header3 = "__Pyx_PyMODINIT_FUNC %s(void)" % self.mod_init_func_cname('PyInit', env)
code.putln("#if PY_MAJOR_VERSION < 3")
......
......@@ -598,6 +598,29 @@ class __Pyx_FakeReference {
#endif
/////////////// PyModInitFuncType.proto ///////////////
#if PY_MAJOR_VERSION < 3
#ifdef CYTHON_NO_PYINIT_EXPORT
// define this to void manually because PyMODINIT_FUNC adds __declspec(dllexport) to it's definition.
#define __Pyx_PyMODINIT_FUNC void
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#else
#ifdef CYTHON_NO_PYINIT_EXPORT
// define this to PyObject * manually because PyMODINIT_FUNC adds __declspec(dllexport) to it's definition.
#define __Pyx_PyMODINIT_FUNC PyObject *
#else
#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC
#endif
#endif
/////////////// FastTypeChecks.proto ///////////////
#if CYTHON_COMPILING_IN_CPYTHON
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment