aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cppgenerator.cpp15
-rw-r--r--headergenerator.cpp18
-rw-r--r--headergenerator.h1
-rw-r--r--shibokengenerator.cpp5
-rw-r--r--shibokengenerator.h3
5 files changed, 9 insertions, 33 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()) {
diff --git a/headergenerator.cpp b/headergenerator.cpp
index 1c761639a..0d7524cbd 100644
--- a/headergenerator.cpp
+++ b/headergenerator.cpp
@@ -395,7 +395,6 @@ void HeaderGenerator::finishGeneration()
s << "#include <memory>" << endl << endl;
if (usePySideExtensions())
s << "#include <qsignal.h>" << endl;
- writeExportMacros(s);
QStringList requiredTargetImports = TypeDatabase::instance()->requiredTargetImports();
if (!requiredTargetImports.isEmpty()) {
@@ -465,23 +464,6 @@ void HeaderGenerator::finishGeneration()
s << "#endif // " << includeShield << endl << endl;
}
-
-void HeaderGenerator::writeExportMacros(QTextStream& s)
-{
- QString macro = getApiExportMacro();
- s << "\
-#if defined _WIN32 || defined __CYGWIN__\n\
- #define " << macro << " __declspec(dllexport)\n\
-#else\n\
-#if __GNUC__ >= 4\n\
- #define " << macro << " __attribute__ ((visibility(\"default\")))\n\
-#else\n\
- #define " << macro << "\n\
-#endif\n\
-#endif\n\
-\n";
-}
-
void HeaderGenerator::writeSbkTypeFunction(QTextStream& s, const AbstractMetaEnum* cppEnum)
{
QString enumName = cppEnum->name();
diff --git a/headergenerator.h b/headergenerator.h
index a8879d1dc..22dced489 100644
--- a/headergenerator.h
+++ b/headergenerator.h
@@ -43,7 +43,6 @@ private:
void writePureVirtualEmptyImpl(QTextStream& , const AbstractMetaFunction* func) const;
void writeDefaultImplementation(QTextStream& s, const AbstractMetaFunction* func) const;
void writeTypeCheckMacro(QTextStream& s, const TypeEntry* type);
- void writeExportMacros(QTextStream& s);
void writeTypeConverterDecl(QTextStream& s, const TypeEntry* type);
void writeSbkTypeFunction(QTextStream& s, const AbstractMetaEnum* cppEnum);
void writeSbkTypeFunction(QTextStream& s, const AbstractMetaClass* cppClass);
diff --git a/shibokengenerator.cpp b/shibokengenerator.cpp
index e9aadd08e..0f862f525 100644
--- a/shibokengenerator.cpp
+++ b/shibokengenerator.cpp
@@ -1442,11 +1442,6 @@ AbstractMetaClassList ShibokenGenerator::getAllAncestors(const AbstractMetaClass
return result;
}
-QString ShibokenGenerator::getApiExportMacro() const
-{
- return "SHIBOKEN_"+moduleName().toUpper()+"_API"; // a longer name to avoid name clashes
-}
-
QString ShibokenGenerator::getModuleHeaderFileName(const QString& moduleName) const
{
QString result = moduleName.isEmpty() ? packageName() : moduleName;
diff --git a/shibokengenerator.h b/shibokengenerator.h
index c1f856ffd..8ab6d7c51 100644
--- a/shibokengenerator.h
+++ b/shibokengenerator.h
@@ -287,9 +287,6 @@ public:
QString getFunctionReturnType(const AbstractMetaFunction* func, Options options = NoOption) const;
QString getFormatUnitString(const AbstractMetaFunction* func, bool incRef = false) const;
- /// Returns the name of the macro used to export symbols
- QString getApiExportMacro() const;
-
/// Returns the file name for the module global header. If no module name is provided the current will be used.
QString getModuleHeaderFileName(const QString& moduleName = QString()) const;