(1) 实现dll程序 dlltest.cpp
#include "windows.h"
BOOL APIENTRY DLLMain(HANDLE hModule , DWORD ul_reason_for_call , LPVOID lpReserved)
{
return true;
}
exten "C"_declspec(dllexport) int MyCopyFile(LPCSTR src , LPCSTR tar)
{
if(CopyFile (src ,tar, fale)==true)
return 1;
else
return 0;
}
(2) 测试dll程序
#include "Windows.h"
extern "C"_declspec(dllexport) int MyCopyFile(LPCSTR , LPCSTR);
int main(int argc , char **argv)
{
MyCopyFile("c:\\1.txt", "c:\\2.txt");
return 0;
}