• 3263阅读
  • 1回复

extern "C" _declspec(dllimport)用法?【以解决】 [复制链接]

上一主题 下一主题
离线那个谁
 

只看楼主 倒序阅读 使用道具 楼主  发表于: 2013-11-20
dllimport, dllexport
Microsoft Specific

__declspec( dllimport ) declarator

__declspec( dllexport ) declarator

The dllexport and dllimport storage-class attributes are Microsoft-specific extensions to the C and C++ languages. They enable you to export and import functions, data, and objects to and from a DLL. These attributes explicitly define the DLL’s interface to its client, which can be the executable file or another DLL. Declaring functions as dllexport eliminates the need for a module-definition (.DEF) file, at least with respect to the specification of exported functions. Note that dllexport replaces the __export keyword.

The declaration of dllexport and dllimport uses extended attribute syntax.Example

// Example of the dllimport and dllexport class attributes
__declspec( dllimport ) int i;
__declspec( dllexport ) void func();

extern "C" _declspec(dllexport) LRESULT KeyBoardProc(int nCode,WPARAM wParam,LPARAM lParam)
{
    if(nCode==HC_ACTION)
{
}
return 0;
}

离线天道酬勤

只看该作者 沙发  发表于: 2013-12-18
extern "C" 代表是用C语言写的函数,名称不会被粉碎
快速回复
限100 字节
批量上传需要先选择文件,再选择上传
 
上一个 下一个