Forum > Linux PDAs
[solved] Using .so libraries on Linux-arm
DelphiDinosaur:
After some time, I have FPC v3.2.2 and Lazarus 1.8.4 running on a Variscite arm. I can compile and run terminal apps quite happily.
I'm having trouble loading libraries. The attached code works fine on a Linux desktop PC (FPC 3.2.0 & Laz 2.0.12). However, the LoadLibrary function always returns 0 on the same code compiled on the arm.
Using nm -D on the .so lists the exported function on the arm compiled code.
I've used the LoadLibrary function for years on Delphi 6 and XE3 so don't believe there's anything fundamentally wrong with the code. I suspect it's a magic rune in Linux that needs setting.
Any suggestions?
MarkMLl:
Attached is my own library loader, which you might find useful as a known-working example. It underpins the code at e.g. https://github.com/MarkMLl/asound
MarkMLl
PascalDragon:
--- Quote from: DelphiDinosaur on December 01, 2021, 05:55:43 pm ---I'm having trouble loading libraries. The attached code works fine on a Linux desktop PC (FPC 3.2.0 & Laz 2.0.12). However, the LoadLibrary function always returns 0 on the same code compiled on the arm.
--- End quote ---
What does GetLoadErrorStr return? What options did you use to compile both the program and the library?
DelphiDinosaur:
--- Quote from: PascalDragon on December 02, 2021, 09:18:58 am ---What does GetLoadErrorStr return? What options did you use to compile both the program and the library?
--- End quote ---
GetLoadErrorStr returns "can't open shared object file: No such file or directory", and includes the exact path to the .so (path case matches). The earlier line checking FileExists finds the file.
The same code works with a third party .so saved in the same location so I'm confident it's not the calling program that's the problem.
The library file is compiled with the standard settings when Lazarus starts a new Library project. Any suggestions as to what may need changing?
DD.
DelphiDinosaur:
Found the answer on Stack Overflow.
Added initc to the uses section was all that was needed.
Seemingly, cmem or LCL may also work but I haven't tried them.
Thanks for your time if you looked at this.
DD.
Navigation
[0] Message Index
[#] Next page