Unresolved extern "dwTlsIndex" exported function in dll
-
Hi I have a c DLL. the Dllmain and the exported function(s) are in different source files. Since the exported function need the value of the variable dwTlsindex. I decalre as an extern I both define it and declare it in DllMain
extern DWORD dwTlsIndex;
static DWORD dwTlsIndex;
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)in the exported function the following is the definition I know I have used the extern storage specifier with out any problem many times maybe there is something different because this is a DLL as the linker cant resolve dwTlsIndex
#else
\_\_declspec(dllexport) void opendata(char \*);
#endif
extern DWORD dwTlsIndex; void opendata(char \*filename) { typedef void \*(DLL\_FN)(char \*);
-
Hi I have a c DLL. the Dllmain and the exported function(s) are in different source files. Since the exported function need the value of the variable dwTlsindex. I decalre as an extern I both define it and declare it in DllMain
extern DWORD dwTlsIndex;
static DWORD dwTlsIndex;
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)in the exported function the following is the definition I know I have used the extern storage specifier with out any problem many times maybe there is something different because this is a DLL as the linker cant resolve dwTlsIndex
#else
\_\_declspec(dllexport) void opendata(char \*);
#endif
extern DWORD dwTlsIndex; void opendata(char \*filename) { typedef void \*(DLL\_FN)(char \*);
Quote:
extern DWORD dwTlsIndex; static DWORD dwTlsIndex;
You should just write
DWORD dwTlsIndex;
because:
- You don't need the extern declaration in the file that defines the variable.
- The
static
keyword makes the variable having file-scope (link failure).
-
Quote:
extern DWORD dwTlsIndex; static DWORD dwTlsIndex;
You should just write
DWORD dwTlsIndex;
because:
- You don't need the extern declaration in the file that defines the variable.
- The
static
keyword makes the variable having file-scope (link failure).