diff options
author | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-08-19 18:40:36 -0300 |
---|---|---|
committer | Hugo Parente Lima <hugo.pl@gmail.com> | 2010-08-19 18:55:10 -0300 |
commit | b0ae63688bb1299476188ad9f1c022553a25912a (patch) | |
tree | 70e492cd54fdec279d692d8e1f672c35e6cbda85 /cppgenerator.cpp | |
parent | 2937fea56a9899627ddf4c796f7445bbbf94b0c2 (diff) |
Get ride of PyMODINIT_FUNC, since it doesn't correctly set the visibility rules on Linux.
Reviewer: Renato Araújo <renato.filho@openbossa.org>
Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'cppgenerator.cpp')
-rw-r--r-- | cppgenerator.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/cppgenerator.cpp b/cppgenerator.cpp index 2b2eeb1ab..87adfc8a9 100644 --- a/cppgenerator.cpp +++ b/cppgenerator.cpp @@ -3519,9 +3519,6 @@ void CppGenerator::finishGeneration() s << "#include <shiboken.h>" << endl; s << "#include <algorithm>" << endl; - s << "#ifndef PyMODINIT_FUNC /* declarations for DLL import/export */" << endl; - s << "#define PyMODINIT_FUNC void" << endl << "#endif" << endl << endl; - s << "#include \"" << getModuleHeaderFileName() << '"' << endl << endl; foreach (const Include& include, includes) s << include; @@ -3586,9 +3583,16 @@ void CppGenerator::finishGeneration() } s << endl; - s << "extern \"C\" {" << endl << endl; - s << "PyMODINIT_FUNC " << getApiExportMacro() << endl << "init" << moduleName() << "()" << endl; + s << "#if defined _WIN32 || defined __CYGWIN__" << endl; + s << " #define SBK_EXPORT_MODULE __declspec(dllexport)" << endl; + s << "#elif __GNUC__ >= 4" << endl; + s << " #define SBK_EXPORT_MODULE __attribute__ ((visibility(\"default\")))" << endl; + s << "#else" << endl; + s << " #define SBK_EXPORT_MODULE" << endl; + s << "#endif" << endl << endl; + + s << "extern \"C\" SBK_EXPORT_MODULE void init" << moduleName() << "()" << endl; s << '{' << endl; // module inject-code target/beginning @@ -3674,7 +3678,6 @@ void CppGenerator::finishGeneration() } s << '}' << endl << endl; - s << "} // extern \"C\"" << endl << endl; // module inject-code native/end if (!snips.isEmpty()) { |