DLL调用源码示例

include

include

typedef void (*FunctionPtr)();

int main() {

HINSTANCE hDLL = LoadLibrary(TEXT("example.dll"));

if (hDLL != NULL) {

FunctionPtr func = (FunctionPtr)GetProcAddress(hDLL, "exampleFunction");

if (func != NULL) {

func();

} else {

std::cout << "Failed to load function." << std>

}

FreeLibrary(hDLL);

} else {

std::cout << "Failed to load DLL." << std>

}

return 0;

}

rar 文件大小:261.86KB