How to call a function in a DLL in Delphi 3?
Posted on 1998-09-01
Hi all... I have made a DLL in C language with the following function:
UINT WINAPI Desasm( UINT current, LPSTR target, LPSTR start );
(UINT = Unsigned int, LPSTR = Long pointer String)
The question is.. how can I declare such function in Delphi? I have:
function Desasm( Address: Integer; Target : string; Start : PChar): Integer; external 'Desasm.dll';
just after starting implementation part of the unit.
Later in other function I tried to call it this way:
Texto : string;
Buf : array[0..19] of Char;
Buf := #18;
Buf := #00;
Buf := #38;
Desasm( 0, Texto, Buf );
ShowMessage( Texto );
The fact is that Texto must contain a string, but on return, it contains nothing. If I try to use stdcall in declaration of the function, application crashes.
Note: the DLL does work!
Who can help me?
Thanks in advance