Forum > Unix
Loading .so Files in Program
PatrickS:
Dear Community,
I have a Problem. At the moment I'am trying to load a shard lib into a lazarus prgramm. The *.so files is created also with lazarus but the Lib is not loaded (file exists).
The Hardware is an BananaPi with armhf aritectur. (fpc and lazarus are also running under armhf (debian wheezy))
Is there any solution or workaround to fix this? Or did anybody achieved something like tis befor?
Leledumbo:
Where's the library located?
PatrickS:
It is located in the source folder of the new project.
Sorry I'am new to this forum.
I'am using lazarus version 1.2.6 with the fpc-2.6.4 compiler using gtk2, the processor achitecture is armhf running with Bananian15.04 (Debian 7/Wheezy)).
I'm trying to load a shared library in my new lazarus project using this (pseudo code):
uses ...dynlibs...
procedure UseDLL;
type
TMyFunc=function (aInt:Integer; aStr: string):String; StdCall;
var
MyLibC: TLibHandle= dynlibs.NilHandle;
MyFunc: TMyFunc;
FuncResult: string;
begin
MyLibC := LoadLibrary('libc.so');
if MyLibC = dynlibs.NilHandle then Exit; //DLL was not loaded successfully
MyFunc:= TMyFunc(GetProcedureAddress(MyLibC, 'MyFunc');
FuncResult:= MyFunc (5,'Test'); //Executes the function
if MyLibC <> DynLibs.NilHandle then if FreeLibrary(MyLibC) then MyLibC:= DynLibs.NilHandle;
the shared lib is also created on thiy computer system with lazarus, but it fails to load. But it is possible to load other libs which are not created by lazarus/fpc.
Leledumbo:
What does GetLoadErrorStr say?
PatrickS:
The file or could not be found or be opened, but the Files defintely exists. ( also the speeling is correct checked serveral times).
I will recheck with some other files and will report
Thank you four your help.
Also tried with this:
LoadLibrary('Path_toFile.so') does not work....
Navigation
[0] Message Index
[#] Next page