I'm having trouble using a DLL function with an int* parameter.
DLL supplier information:
The function is declared in the DLL as:
int sendQuoGetInfDstn(char* nomed, int *rigd)
I have imported this into Delphi 11 using:
const
QUODLL = 'PcQuoDllNoWrap.dll';
implementation
function sendQuoGetInfDstn(Name: PAnsiChar; Count: PInteger): integer; stdcall; external QUODLL;
This compiles fine.
My question is, how do I call this function from my Delphi program? I have tried all sorts of things, but I get Access violation errors or program crash.
For example, I have made this wrapper:
function TPCQuo.GetWorklistInfoTest(Name: String; Count: integer): integer;
begin
Result := sendQuoGetInfDstn(PAnsiChar(Ansistring(Name)), @Count); {I have also tried PInteger(Count)}
end;
And I call the wrapper like this:
procedure TForm1.Button4Click(Sender: TObject);
var
name: String;
count: integer;
begin
if QUO.GetWorklistInfoTest(name, count) <> 0 then
ShowMessage('No worklist available ')
else
ShowMessage('Worklist available ' + name + ' number of lines: ' + count.ToString );
end;
So, how should I call this function?

cdeclorstdcallis one detail you have to work out. And it seems clear that both arguments should bevardeclared.varsuggestionGetWorklistInfoTestfunction.