Link to home
Start Free TrialLog in
Avatar of joshual
joshual

asked on

export template class in MFC extension DLL

I know I can't export a template class in MFC extension DLL bu doing

template<class T>
class AFX_EXT_CLASS CSharedMemT: public CObject
{
...

I was told to "explicitly instantiate the template-based classes I really want to export, and export those on a case-by-case basis"

My Q is, how do I do that in the MFC extension DLL? I need shor, simple deom code on how this can be implemented.

Thanks

Joshua
Avatar of galkin
galkin

You cannot export template clas. Instaed you must define all functions of the template class as inline(wighout __declspec(_dllexport)) and simply include header whre you want to use it. Template class is actually created by compiler based on parameter passed.
Avatar of joshual

ASKER

What is the point of exporting the function when you can't export the class? As I have said in my Q, maybe can you show me a short smaple program.

Thanks.

ASKER CERTIFIED SOLUTION
Avatar of galkin
galkin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial