From Roger James, reworked the export of std::vector<> on standard types to prevent

problems with .lib being built for all targets under VS7.x
This commit is contained in:
Robert Osfield
2005-11-21 13:51:24 +00:00
parent 8dd631f4ec
commit 8289eecb7e
5 changed files with 31 additions and 23 deletions

View File

@@ -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 <vector>
#if defined( OSG_LIBRARY )
template class __declspec(dllexport) std::allocator<int>; // GLsizei
template class __declspec(dllexport) std::vector<int, std::allocator<int> >; // GLsizei
template class __declspec(dllexport) std::allocator<unsigned char>; // GLubyte
template class __declspec(dllexport) std::vector<unsigned char, std::allocator<unsigned char> >; // GLubyte
template class __declspec(dllexport) std::allocator<unsigned short>; // GLushort
template class __declspec(dllexport) std::vector<unsigned short, std::allocator<unsigned short> >; // GLushort
template class __declspec(dllexport) std::allocator<unsigned int>; // GLuint
template class __declspec(dllexport) std::vector<unsigned int, std::allocator<unsigned int> >; // GLuint
#else
#pragma warning ( push )
#pragma warning ( disable : 4231 )
extern template class __declspec(dllimport) std::allocator<int>; // GLsizei
extern template class __declspec(dllimport) std::vector<int, std::allocator<int> >; // GLsizei
extern template class __declspec(dllimport) std::allocator<unsigned char>; // GLubyte
extern template class __declspec(dllimport) std::vector<unsigned char, std::allocator<unsigned char> >; // GLubyte
extern template class __declspec(dllimport) std::allocator<unsigned short>; // GLushort
extern template class __declspec(dllimport) std::vector<unsigned short, std::allocator<unsigned short> >; // GLushort
extern template class __declspec(dllimport) std::allocator<unsigned int>; // GLuint
extern template class __declspec(dllimport) std::vector<unsigned int, std::allocator<unsigned int> >; // 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)

View File

@@ -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<GLsizei>;
template class __declspec(dllexport) std::vector<GLsizei, std::allocator<GLsizei> >;
template class __declspec(dllexport) std::allocator<GLubyte>;
template class __declspec(dllexport) std::vector<GLubyte, std::allocator<GLubyte> >;
template class __declspec(dllexport) std::allocator<GLushort>;
template class __declspec(dllexport) std::vector<GLushort, std::allocator<GLushort> >;
template class __declspec(dllexport) std::allocator<GLuint>;
template class __declspec(dllexport) std::vector<GLuint, std::allocator<GLuint> >;
#endif
#endif
class PrimitiveSet : public Object
{
public:

View File

@@ -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<unsigned int>;
template class __declspec(dllexport) std::vector<unsigned int, std::allocator<unsigned int> >;
#endif
#endif
class OSGTEXT_EXPORT String : public osg::Referenced, public std::vector<unsigned int>
{
public:

View File

@@ -28,6 +28,7 @@
#include <vector>
#include <fstream>
#include <osg/Export>
#include <osg/Math>
namespace DX {

View File

@@ -53,6 +53,9 @@
typedef __int64 int64;
#endif
// Get the template intantiations for basic types
#include <osg/Export>
#else // Unix
#include <stdio.h>