13,825
社区成员
发帖
与我相关
我的任务
分享
//头文件Unit2.h里
//---------------------------------------------------------------------------
[code=C/C++]
#ifndef Unit2H
#define Unit2H
#include <StdCtrls.hpp>
char * _stdcall (*ShowForm)(char *);
double (*Add)(double x ,double y);
void loadDll();
HINSTANCE hInst=NULL;
//---------------------------------------------------------------------------
#endif
//源文件Unit2.h里
#pragma hdrstop
#include "Unit2.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
void loadDll()
{
hInst = LoadLibrary("MyDll.DLL");
if(hInst)
{
(FARPROC &)ShowForm=GetProcAddress(hInst,"ShowForm" );
(FARPROC &)Add=GetProcAddress(hInst,"Add" );
}
else
{
// MessageBox(Handle,"无法加载DllServer.dll文件","信息提示",MB_OK);
FreeLibrary(hInst);
}
}