Commit e4cd5024 authored by Brad King's avatar Brad King 💬
Browse files

BUG: Fixed init function export on cygwin.

parent 3ef9221b
......@@ -10,6 +10,18 @@ static void CreateInitFile(const char *libName,
int i;
#if defined(_WIN32) && !defined(__CYGWIN__)
const char* prefix = "";
const char* prefix = "lib";
#if defined(_WIN32)
const char* dllexp = "__declspec(dllexport) ";
const char* dllexp = "";
fprintf(fout,"// Generated by vtkWrapPythonInit in VTK/Wrapping\n");
fprintf(fout,"#include \"vtkPython.h\"\n\n");
fprintf(fout,"#include \"vtkSystemIncludes.h\"\n");
......@@ -21,33 +33,18 @@ static void CreateInitFile(const char *libName,
for (i = 0; i < numConcrete; i++)
#ifdef _WIN32
fprintf(fout,"extern \"C\" {__declspec( dllexport) PyObject *PyVTKClass_%sNew(char *); }\n", concrete[i]);
fprintf(fout,"extern \"C\" {PyObject *PyVTKClass_%sNew(char *); }\n",concrete[i]);
fprintf(fout,"extern \"C\" {%sPyObject *PyVTKClass_%sNew(char *); }\n", dllexp, concrete[i]);
fprintf(fout,"\nstatic PyMethodDef Py%s_ClassMethods[] = {\n",
fprintf(fout,"\nstatic PyMethodDef Py%s_ClassMethods[] = {\n", libName);
fprintf(fout,"{NULL, NULL, 0, NULL}};\n\n");
#ifdef _WIN32
fprintf(fout,"extern \"C\" {__declspec( dllexport) void init%s();}\n\n",libName);
fprintf(fout,"void init%s()\n{\n",libName);
fprintf(fout,"extern \"C\" {void initlib%s();}\n\n",libName);
fprintf(fout,"void initlib%s()\n{\n",libName);
fprintf(fout,"extern \"C\" {%svoid init%s%s();}\n\n", dllexp, prefix, libName);
fprintf(fout,"void init%s%s()\n{\n", prefix, libName);
/* module init function */
fprintf(fout," PyObject *m, *d, *c;\n\n");
#ifdef _WIN32
fprintf(fout," static const char modulename[] = \"%s\";\n",libName);
fprintf(fout," static const char modulename[] = \"lib%s\";\n",libName);
fprintf(fout," static const char modulename[] = \"%s%s\";\n", prefix, libName);
fprintf(fout," m = Py_InitModule((char*)modulename, Py%s_ClassMethods);\n",
Supports Markdown
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