Hi all,

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:

Code:
#if !defined MYDLL_DLL_H
#define MYDLL_DLL_H
 
  #ifdef MYDLL_DLL_EXPORTS
  #define MYDLL_DLL_API __declspec(dllexport)
  #else
  #define MYDLL_DLL_API __declspec(dllimport)
  #endif
 
 extern MYDLL_DLL_API HWND g_TargetHwnd;

#endif // !defined(MYDLL_DLL_H)
Now this is the code in the cpp file which is causing me the headache:

Code:
#pragma data_seg (".shared")
HWND	g_TargetHwnd = 0;
#pragma data_seg ()

#pragma comment(linker,"/SECTION:.shared,RWS")
Now for some reason I keep getting that warning. I have no idea why because i have used this technique before fine.

Any ideas?