{Dinamik dll çağırmaktaki avantaj; memoryde sadece çağrıldığı zaman
yer işkal etmesi, dinamik olaral dll kütüphanesinin versiyon bilgilerinin
kontrolu ve diskte yer alıp almadığının önceden kontrolu gibi avantajlar sağlar.
murat oral
muat_oral2000@yahoo.com
}
procedure CallDllProc(Flag1: Integer; Flag2, Flag3, Flag5, Flag5: String);
type
TDLLFunc = procedure(Param1: Integer; Param2, Param3, Param4, Param5: String);
{assign a nil - not loaded function}
const
DLLFunc: TDLLFunc = nil;
DLLFuncName: PChar = 'ExportData';
DLLName: PChar = 'Export.dll';
{handle of loaded dll}
var
DLLHandle: THandle;
begin
{ load a library }
DLLHandle := LoadLibrary(DLLName);
if (DLLHandle < HINSTANCE_ERROR) then
raise Exception.Create(DLLName + ' library can not be loaded or not found. ' + SysErrorMessage(GetLastError));
try
{ load an address of required procedure}
@DLLFunc := GetProcAddress(DLLHandle, DLLFuncName);
{if procedure is found in the dll}
if Assigned(DLLFunc) then
DLLFunc(Flag1, Flag2, Flag3, Flag4, Flag5);
finally
{unload a library}
FreeLibrary(DLLHandle);
end;
end;