static data members in structure
Hi everybody!
I am in great trouble regarding structures.It is as follow:-
I am developing a DLL in C++ using VC++ editor.This DLL is called by the another C++
programme to achive some functonality.
I declared a structure as follow:
Code:
typedef struct{
static char szOriginalAddress[0x100];
static char szRecipientAddress[0x100];
static char szFileName[0x100];
} TExternalFilter;
#import "C:\Program Files\Common Files\System\ADO\msado15.dll" \
no_namespace rename ("EOF", "ADOEOF")
EXPORT DWORD Filter(TExternalFilter* );
This is header file in which declaration has been done.
The programme in which this header file is used is as follow:-
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{
return TRUE;
}
EXPORT DWORD Filter(TExternalFilter* ExternalFilter)
{
static char temp[256];
strcpy(temp,ExternalFilter->szOriginalAddress);
}
This file is called by our main CPP program.
When i compile this program it gives following Linker error in DLL:
error LNK2001: unresolved external symbol "public: static char * __unnamed::szOriginalAddress" (?szOriginalAddress@__unnamed@@2PADA)
This error is due to variable are declare as static in DLL, but I want these member as
static only.Please tell me what code and where should I implement so that I can remove this
problem.
Added : How can I declare and define these static member variables? The linker error may be due to static variables not being defiined but only declared.
Please help in solving this problem.
I will be very thankful.
Thanks in advanced
Bhagwat
declaring and intializing static variables
Thanks for your reply!
How can I declare and define these static member variables? The linker error may be due to static variables not being defiined but only declared.
Waiting for your reply .
Thanks