[fpc-pascal] [HOW TO] Create a shared object (SO) with FP

Jilani Khaldi jilani at cheapnet.it
Fri Apr 22 18:31:33 CEST 2011


{$linklib c}

uses
   dynlibs;

procedure hello(const x: double); cdecl; external 'libmylib.so';

var
   lHandle: TLibHandle;
   v: double;
begin
   lHandle := LoadLibrary('./libmylib.so');
   if lHandle <> nilHandle then
   begin
     v := 3.14159;
     hello(v);
   end else
     writeln('Cannot load "mylib.so"')
end.

It is compiled without error but when I run it it throws:
./testlib: error while loading shared libraries: libmylib.so: cannot 
open shared object file: No such file or directory.

What I did I miss?.
Thank you.

--
Jilani KHALDI
** Architectura Vindex
http://www.vindexa.org



More information about the fpc-pascal mailing list