以下是动态调用Lindo线性规划dll链接库的范例,请参考!
var
LindoDllHandle :THandle;
ILINDO
rocedure;
Stdcall;
INIT
rocedure;
Stdcall;
LUNOPN
rocedure(Lunit: PLongint;
Lfname: PLongint;
ByValKfname: Pchar;
Inrout: PLongint;
Notfmt: PLongint;
Lutrmi: PLongint;
Lutrmo: PLongint);
Stdcall;
CAPOUT
rocedure(Dunit: PLongint);
Stdcall;
QUIET
rocedure(j: PLongint);
Stdcall;
DEFROW
rocedure(Idir: PLongint;
Rhs: PSingle;
Idrow: PLongint;
Trouble: PLongint);
Stdcall;
APPCOL
rocedure(ByValKname: Pchar;
Nonz: PLongint;
Value: PSingle;
Idrow: PLongint;
Trouble: PLongint);
Stdcall;
GO
rocedure(Limgo: PLongint;
Istat: PLongint);
Stdcall;
REPROW
rocedure(i: PLongint;
Primal: PSingle;
Dual: PSingle);
Stdcall;
REPVAR
rocedure(i: PLongint;
Primal: PSingle;
Dual: PSingle);
Stdcall;
LSEXIT
rocedure;
Stdcall;
MAKINT
rocedure(i: PLongint);
Stdcall;
begin
//动态载入 "
LNDDLL32.DLL "
文件
str := GetCurrentDir;
str := str + '/LNDDLL32.DLL';
LindoDllHandle := loadlibrary(Pchar(str));
if LindoDllHandle<32 then
begin
Application.MessageBox('代码结构载入失败!',PChar('系统提示'),MB_ICONWARNING+MB_OK);
exit;
end;
@ILINDO := GetProcAddress(LindoDllHandle,'ILINDO_STD');
@INIT := GetProcAddress(LindoDllHandle,'INIT_STD');
@LUNOPN := GetProcAddress(LindoDllHandle,'LUNOPNX_STD');
@CAPOUT := GetProcAddress(LindoDllHandle,'CAPOUT_STD');
@QUIET := GetProcAddress(LindoDllHandle,'QUIET_STD');
@DEFROW := GetProcAddress(LindoDllHandle,'DEFROW_STD');
@APPCOL := GetProcAddress(LindoDllHandle,'APPCOLX_STD');
@GO := GetProcAddress(LindoDllHandle,'GO_STD');
@REPROW := GetProcAddress(LindoDllHandle,'REPROW_STD');
@REPVAR := GetProcAddress(LindoDllHandle,'REPVAR_STD');
@LSEXIT := GetProcAddress(LindoDllHandle,'LSEXIT_STD');
@MAKINT := GetProcAddress(LindoDllHandle,'MAKINT_STD');
FreeLibrary(LindoDllHandle);
end;