writing to a shared variable in a dll
I have a dll file which im loading using LoadLibrary. I wish to pass the dll my windows HWND by including the dll header file in my exe and using decl(dllimport) to assign to it. Problem is that i'm getting the warning.
c4273 g_TargetHwnd inconsistent dll linkage
This is my code:
Dll Header File:
Now this is the code in the cpp file which is causing me the headache:
#if !defined MYDLL_DLL_H
#define MYDLL_DLL_API __declspec(dllexport)
#define MYDLL_DLL_API __declspec(dllimport)
extern MYDLL_DLL_API HWND g_TargetHwnd;
#endif // !defined(MYDLL_DLL_H)
Now for some reason I keep getting that warning. I have no idea why because i have used this technique before fine.
#pragma data_seg (".shared")
HWND g_TargetHwnd = 0;
#pragma data_seg ()