From 229ba91523794b85ce4a4883a975f63c80252b77 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 10 Dec 2009 14:38:36 +0200 Subject: Export type maps in GCC 4.x using the visibility attribute --- xsd/cxx/tree/tree-source.cxx | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'xsd/cxx/tree/tree-source.cxx') diff --git a/xsd/cxx/tree/tree-source.cxx b/xsd/cxx/tree/tree-source.cxx index fa9046f..48702a1 100644 --- a/xsd/cxx/tree/tree-source.cxx +++ b/xsd/cxx/tree/tree-source.cxx @@ -3376,14 +3376,13 @@ namespace CXX if (import_maps || export_maps) { - ctx.os << "#ifdef _MSC_VER" << endl - << endl - << "namespace xsd" + ctx.os << "namespace xsd" << "{" << "namespace cxx" << "{" << "namespace tree" - << "{"; + << "{" + << "#ifdef _MSC_VER" << endl; if (parsing && export_maps) ctx.os << "template struct __declspec (dllexport) " << @@ -3401,11 +3400,20 @@ namespace CXX ctx.os << "template struct __declspec (dllimport) " << "comparison_plate< 0, " << ctx.char_type << " >;"; - ctx.os << "}" // tree - << "}" // cxx - << "}" // xsd - << "#endif // _MSC_VER" << endl - << endl; + ctx.os << "#elif defined(__GNUC__) && __GNUC__ >= 4" << endl; + + if (parsing) + ctx.os << "template struct __attribute__ ((visibility(\"default\"))) " << + "type_factory_plate< 0, " << ctx.char_type << " >;"; + + if (comparison) + ctx.os << "template struct __attribute__ ((visibility(\"default\"))) " << + "comparison_plate< 0, " << ctx.char_type << " >;"; + + ctx.os << "#endif" << endl + << "}" // tree + << "}" // cxx + << "}"; // xsd } ctx.os << "namespace _xsd" -- cgit v1.1