diff --git a/include/osg/Export b/include/osg/Export index 0852e2894..5b0b6f757 100644 --- a/include/osg/Export +++ b/include/osg/Export @@ -42,6 +42,33 @@ # define OSG_EXPORT #endif +// export template instances for basic types +#if (_MSC_VER >= 1100) && !defined( OSG_LIBRARY_STATIC ) // This should work from VC5.0 onwards +#include +#if defined( OSG_LIBRARY ) +template class __declspec(dllexport) std::allocator; // GLsizei +template class __declspec(dllexport) std::vector >; // GLsizei +template class __declspec(dllexport) std::allocator; // GLubyte +template class __declspec(dllexport) std::vector >; // GLubyte +template class __declspec(dllexport) std::allocator; // GLushort +template class __declspec(dllexport) std::vector >; // GLushort +template class __declspec(dllexport) std::allocator; // GLuint +template class __declspec(dllexport) std::vector >; // GLuint +#else +#pragma warning ( push ) +#pragma warning ( disable : 4231 ) +extern template class __declspec(dllimport) std::allocator; // GLsizei +extern template class __declspec(dllimport) std::vector >; // GLsizei +extern template class __declspec(dllimport) std::allocator; // GLubyte +extern template class __declspec(dllimport) std::vector >; // GLubyte +extern template class __declspec(dllimport) std::allocator; // GLushort +extern template class __declspec(dllimport) std::vector >; // GLushort +extern template class __declspec(dllimport) std::allocator; // GLuint +extern template class __declspec(dllimport) std::vector >; // GLuint +#pragma warning ( pop ) +#endif +#endif + // set up define for whether member templates are supported by VisualStudio compilers. #ifdef _MSC_VER # if (_MSC_VER >= 1300) diff --git a/include/osg/PrimitiveSet b/include/osg/PrimitiveSet index 9fdc7de85..1729ac0b7 100644 --- a/include/osg/PrimitiveSet +++ b/include/osg/PrimitiveSet @@ -71,21 +71,6 @@ public: virtual void end() = 0; }; -// export template instances that are used as base classes -#ifdef _MSC_VER -#if (_MSC_VER>1300) // VS6 doesnt need these -template class __declspec(dllexport) std::allocator; -template class __declspec(dllexport) std::vector >; -template class __declspec(dllexport) std::allocator; -template class __declspec(dllexport) std::vector >; -template class __declspec(dllexport) std::allocator; -template class __declspec(dllexport) std::vector >; -template class __declspec(dllexport) std::allocator; -template class __declspec(dllexport) std::vector >; -#endif -#endif - - class PrimitiveSet : public Object { public: diff --git a/include/osgText/String b/include/osgText/String index 6039fadf9..b8fc08473 100644 --- a/include/osgText/String +++ b/include/osgText/String @@ -25,14 +25,6 @@ namespace osgText { class Text; -// export template instances that are used as base classes -#ifdef _MSC_VER -#if (_MSC_VER>1300) -template class __declspec(dllexport) std::allocator; -template class __declspec(dllexport) std::vector >; -#endif -#endif - class OSGTEXT_EXPORT String : public osg::Referenced, public std::vector { public: diff --git a/src/osgPlugins/directx/directx.h b/src/osgPlugins/directx/directx.h index 410ae99cd..66175c9c5 100644 --- a/src/osgPlugins/directx/directx.h +++ b/src/osgPlugins/directx/directx.h @@ -28,6 +28,7 @@ #include #include +#include #include namespace DX { diff --git a/src/osgPlugins/txp/trpage_sys.h b/src/osgPlugins/txp/trpage_sys.h index baa4e4ff4..5f3de1667 100644 --- a/src/osgPlugins/txp/trpage_sys.h +++ b/src/osgPlugins/txp/trpage_sys.h @@ -53,6 +53,9 @@ typedef __int64 int64; #endif +// Get the template intantiations for basic types +#include + #else // Unix #include