C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem with templates and Dll export

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
Marc André Ueberall
Guest





PostPosted: Thu Jul 24, 2003 8:08 pm    Post subject: Problem with templates and Dll export Reply with quote



Hi there!

I've got the following problem and would be very happy if there is somebody
with a solution! =)

Btw. I'm using Microsoft Visual C++ 6.0 Std Edition

I've generated a template class called "CSingleton"

template <class T>
class __declspec(dllexport) CSingleton
{
static T *lpSingleton;

public:
CSingleton(void);
~CSingleton(void);

static T &GetSingleton(void);
static T *GetSingletonPtr(void);
};

Now I'm going to implement a texture manager (or whatever) like this

class DUSKENGINE_API CTextureManager: public CSingleton<CTextureManager>
{
public:
CTextureManager(void);
~CTextureManager(void);
};

When compiling this I get the following errors:

....
CTextureManager.obj : error LNK2001: "public: __thiscall
DuskEngine::Core::CSingleton<class
DuskEngine::Renderer::CTextureManager>::CSingleton<class
DuskEngine::Renderer::CTextureManager>(void)" (??0?$CSingleton@VCT
extureManager@Renderer@DuskEngine@@@Core@DuskEngine@@QAE@XZ)
CTextureManager.obj : error LNK2001: "public: __thiscall
DuskEngine::Core::CSingleton<class
DuskEngine::Renderer::CTextureManager>::~CSingleton<class
DuskEngine::Renderer::CTextureManager>(void)" (??1?$CSingleton@VC
TextureManager@Renderer@DuskEngine@@@Core@DuskEngine@@QAE@XZ)
....

How do I export home-brew-templates and classes that are using them in a
dll???

Thank you for your comments!


Marc André Ueberall


Back to top
Param
Guest





PostPosted: Mon Aug 18, 2003 2:52 pm    Post subject: Re: Problem with templates and Dll export Reply with quote



Hi
I guess u are right exporting from a DLL is not defined...
But u can try using explicit template instantiation where the Object for the
class is created with some of the known types
i.e. the writer of the class should be aware of the type of instantiations
for that peculiar template class...

This instantiation can be exported from the DLL and then u could use this
class with no Linking errors...

Paramjeet Singh


"Victor Bazarov" <v.Abazarov (AT) attAbi (DOT) com> wrote

Quote:
"Marc André Ueberall" <mueberall (AT) duskengine (DOT) de> wrote...
...

How do I export home-brew-templates and classes that are using them in a
dll???

Exporting from a DLL is not defined by the C++ language. Please
post your compiler-specific question to microsoft.public.vc.language.

Victor





Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.