- 論壇徽章:
- 0
|
我創(chuàng)建了一個Func工程,下面是Func.cpp的代碼:
// Func.cpp : 定義 DLL 應(yīng)用程序的導(dǎo)出函數(shù)。
//
#include "stdafx.h"
extern "C" int WINAPI Add(int,int);
int WINAPI Add(int a, int b)
{
return a+b;
}
dllmain.cpp的代碼:
// dllmain.cpp : 定義 DLL 應(yīng)用程序的入口點。
#include "stdafx.h"
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;
}
為什么只生成Func.dll,沒有Func.lib,并且用depends打開dll看不到Add這個函數(shù),里面都是空的。還請大家?guī)兔φ艺以颍x謝了!
PS:Add的函數(shù)必須是WINAPI類型的。 |
|