1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
| //To select a mode de compilation
{$IFDEF FPC}
{$mode objfpc}{$H+}
{$modeswitch objectivec1}
{$ENDIF}
uses
FastSharemem,
Windows,
U_Small_Lib in 'U_Small_Lib.pas',
System.SysUtils;
type
TArr_VarRec=array of TVarRec;
TdoProduct = function (AArr_Parameters:array of const):integer;cdecl;
TLibHandle = System.THandle;
var
ldoProduct:TdoProduct;
lHandle:TLibHandle;
lVarRecInput: TArr_VarRec;
lVarRecOutput:TArr_VarRec;
x:integer;
test_int: array of integer;
const
NilHandle = TLibHandle(0);
begin
lHandle := LoadLibrary('C:\Users\preparateur\Desktop\Delphi_and_CPP_Tests\Test_fin\dlls\test.dll');
if lHandle <> NilHandle then
begin
@ldoProduct := Get_Dll_Function_Adress(lHandle, 'doProduct');
if @ldoProduct <> nil then
begin
Setlength(lVarRecInput,10);
lVarRecInput[0].VInteger:= 15;
lVarRecInput[1].VInteger:= 10;
ldoProduct(lVarRecInput);
writeln(#13#10,'There are: ',sizeof(PChar),' parameters');
end;
end;
sleep(1000);
end. |
Partager