[Lazarus] Call Load/Unload library from procedure

fabio bor400 at gmail.com
Wed Feb 3 11:20:28 CET 2010


Dnia 2010-02-03, o godz. 10:49:32
Thierry Coq <tcoq at free.fr> napisaƂ(a):

> Hello,
> 
> I confirm the calling conventions should match. Maybe try using the 
> pascal calling convention to debug your code, it is more robust.
> 
> In addition, using strings in DLL calls is a <bad idea> for a
> beginner. Start with arrays of char or PChar.
> Allocate the memory to the PCHAR and pass it as a parameter to the
> DLL. Don't forget to provide the length of the string, so there is no
> buffer overrun.
> ...

Thanks, I change to procedure and set additional parameter as pointer to
my string type Tstr:
   Tstr = record
      p : string;
   end;
   Pstr = ^Tstr;

SiTTestP = procedure (k: integer; outP: Pstr):

and it seems works ok :) Thanks.

regards
Fabio




More information about the Lazarus mailing list