Re: export static public member
- From: "Doug Harrison [MVP]" <dsh@xxxxxxxx>
- Date: Thu, 04 Jan 2007 13:47:21 -0600
On Wed, 3 Jan 2007 11:07:00 -0800, WJ <WJ@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
I have a class defined in project A, and I used AFX_EXT_CLASS to export them.
The AFX_EXT_CLASS macro has a major problem in that headers from multiple
DLLs cannot use it simultaneously. See this message for the proper way to
use __declspec(dllexport|dllimport):
http://groups.google.com/group/microsoft.public.dotnet.languages.vc/msg/9c40e8ab9410eeb1
This class also has some static public member variables.
In project B, I use this class and the public static member variables. I got
link error of unresolved externals of the static public member variables.
(I know public member is bad, but I am working on some old projects)
This works:
// Real code would use a macro instead of the __declspec
struct __declspec(dllexport) X
{
static int exported_int;
};
int X::exported_int;
*****
C>cl -LD a.cpp
C>dumpbin /exports a.dll
ordinal hint RVA name
1 0 00001000 ??4X@@QAEAAU0@ABU0@@Z
2 1 0000ACC0 ?exported_int@X@@2HA
What are you doing differently?
--
Doug Harrison
Visual C++ MVP
.
- References:
- Re: export static public member
- From: Guido Franzke
- Re: export static public member
- Prev by Date: Re: Remote debugging?
- Next by Date: Re: new / delete in a dll
- Previous by thread: Re: export static public member
- Next by thread: Re: Calling Is_High_Surrogate from Visual C++ 6.0
- Index(es):
Relevant Pages
|