summaryrefslogtreecommitdiffstats
path: root/headergenerator.cpp
diff options
context:
space:
mode:
authorHugo Lima <hugo.lima@openbossa.org>2009-11-11 17:22:56 -0200
committerMarcelo Lira <marcelo.lira@openbossa.org>2009-11-12 09:38:36 -0300
commitb58553f67867dc3e09243a137de560f83758f4a4 (patch)
treefbd8e7b9a1dfb0af95c55ec7af8af7da3982a7c0 /headergenerator.cpp
parent627d4cc994ba1c122995b367e2fc63a02d02d04a (diff)
downloadshiboken-b58553f67867dc3e09243a137de560f83758f4a4.tar.gz
shiboken-b58553f67867dc3e09243a137de560f83758f4a4.tar.xz
shiboken-b58553f67867dc3e09243a137de560f83758f4a4.zip
Add visibility policies to libshiboken and for bindings generated by shiboken generator.
As shiboken generator needs minor changes to support inter-module dependencies, these changes about symbol visibility does not support inter-module dependencies, however support it is simple, because we just need to make some symbols visible to other DSO's. Reviewed by Marcelo Lira <marcelo.lira@openbossa.org>
Diffstat (limited to 'headergenerator.cpp')
-rw-r--r--headergenerator.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/headergenerator.cpp b/headergenerator.cpp
index cba8ffb7..6b3ec40a 100644
--- a/headergenerator.cpp
+++ b/headergenerator.cpp
@@ -89,7 +89,7 @@ void HeaderGenerator::generateClass(QTextStream& s, const AbstractMetaClass* met
*/
// Class
- s << "class SHIBOKEN_LOCAL " << wrapperName;
+ s << "class " << wrapperName;
s << " : public " << metaClass->qualifiedCppName();
s << endl << '{' << endl << "public:" << endl;
@@ -318,6 +318,7 @@ void HeaderGenerator::finishGeneration()
s << "#include <bindingmanager.h>" << endl << endl;
s << "#include <memory>" << endl << endl;
+ writeExportMacros(s);
s << "// Class Includes" << endl;
s << classIncludes << endl;
@@ -369,3 +370,21 @@ 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";
+}
+