共享内存DLL的问题!!--用于传递消息信息
我想将截获的消息再传递给调用程序,在DLL中设置了一个结构体作为共享数据段。
在DLL中如下定义:
#pragma data_seg("mydata")
struct ShareData
{
int g_nCode;
WPARAM g_wparam;
LPARAM g_lparam;
} ShareData;
struct ShareData sendMsg;
#pragma data_seg()
extern "C" {ShareData sendMsg;}
在DEF中如下声明:
EXPORTS
; Explicit exports can go here
ShareData CONSTANT
SECTIONS
mydata READ WRITE SHARED
编译出错:
error C2146: syntax error : missing ';' before identifier 'sendMsg'
error C2501: 'ShareData' : missing storage-class or type specifiers
error C2371: 'ShareData' : redefinition; different basic types
D:\MouseHook\MouseHook.cpp(27) : see declaration of 'ShareData'
fatal error C1004: unexpected end of file found Error executing cl.exe.
是什么问题???
或者有什么更好的办法可以传递这些消息。谢谢!!