471,356 Members | 1,646 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,356 software developers and data experts.

Export a generic Class from a DLL - linker error

I want to export a generic Class from a DLL.

I Created two MFC shared dlls. I want to use a class declared in 2nd DLL
from 1st DLL.
1st DLL is created using mfc wizard as MFC shared dll.
Added a class:
class CTestDll2
virtual ~CTestDll();


2nd DLL:
Created using mfc wizard as MFC shared dll. I included the .lib file from
1st DLL in to my 2nd DLL at LINK\INPUT section of the project settings.

I created the instance of the class 'CTestDll2' in 2nd dll.

When I compile, I am getting error (LNK2001: unresolved external symbol
"public:) for the class 'CTestDll2'.

If I add AFX_EXT_CLASS macro to the class, no linker errors.

class AFX_EXT_CLASS CTestDll2
virtual ~CTestDll();


Is it needs to export the class even linking statically?
Is there any way to use the class with qualifying AFX_EXT_CLASS?

Test in .net 2003 and VC++6.0

Thanks in advance.

Jul 21 '05 #1
0 1044

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

205 posts views Thread by Jeremy Siek | last post: by
3 posts views Thread by Robert Bogue [MVP] | last post: by
3 posts views Thread by Hamilton Woods | last post: by
4 posts views Thread by Steven T. Hatton | last post: by
3 posts views Thread by michael | last post: by
6 posts views Thread by Jeffrey Walton | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.