【发布时间】:2019-01-04 14:18:27
【问题描述】:
我正在尝试创建 DLL 文件,但在 DLLMAIN() 中运行函数时遇到问题。
我想做这样的事情:
#include "stdafx.h"
#include <stdio.h>
#include <windows.h>
INT APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved){
switch (ul_reason_for_call) {
case DLL_PROCESS_ATTACH:
foo1();
break;
case DLL_PROCESS_DETACH:
foo2()();
break;
}
return true;
}
void foo1(){
//code
}
void foo2(){
// code
}
但它不起作用。 当我试图构建我得到的文件时
'foo1' identifier not found
'foo2' identifier not found
我在这里做错了什么?
谢谢!
【问题讨论】:
-
这是 C 101;它与 Windows 或 DllMain 无关。函数需要在调用之前声明。
标签: c++