标签:str dllexport spec call ret dll RoCE entry nbsp
dll.cpp,用vc2017编译
#include <iostream>
#include <windows.h>
extern "C" __declspec(dllexport) void Go() {
std::cout << "go" << std::endl;
}
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}
main.cpp 用mingw64的g++编译
#include <iostream>
extern "C" __declspec(dllimport) void Go();
int main (int argc, char **argv)
{
Go();
return 0;
}
将dll.lib dll.dll dll.exp dll.pdb复制到main.cpp当前目录,编译:
g++ main.cpp -ldll -L.
标签:str dllexport spec call ret dll RoCE entry nbsp
原文地址:https://www.cnblogs.com/yuanxiaoping_21cn_com/p/9101306.html