Recent

Author Topic: Loading so,dll libraries from program folder or specified folder.  (Read 1235 times)

Guva

  • Full Member
  • ***
  • Posts: 218
  • 🌈 ZX-Spectrum !!!
Hi everyone, I made a separate topic. In one of the libraries (it seems to be uade), it required several more dll-so. Here's a solution that works!!! 

Add to the Lazarus project settings: Project → Project Options → Compiler Options → Custom Options.

Code: Text  [Select][+][-]
  1. -k"-rpath=$ORIGIN"

For the specified folder
For example, for a nearby folder, "your_folder"

Code: Text  [Select][+][-]
  1. -k"-rpath=$ORIGIN/your_folder"

Thaddy

  • Hero Member
  • *****
  • Posts: 19272
  • Glad to be alive.
Re: Loading so,dll libraries from program folder or specified folder.
« Reply #1 on: July 07, 2025, 06:14:59 am »
Are you sure this works for the internal linker too?
objects are fine constructs. You can even initialize them with constructors.

Fred vS

  • Hero Member
  • *****
  • Posts: 3947
    • StrumPract is the musicians best friend
Re: Loading so,dll libraries from program folder or specified folder.
« Reply #2 on: September 17, 2025, 01:42:52 am »
@Guva: EXCELLENT!

Many thanks, it solves perfectly the problems when the libraries are not in "traditional" directories, like NetBSD, OpenBSD or DragonFlyBSD.

For example in NetBSD adding this parameters you dont need to create symlinks to /usr/lib/ or  /usr/local/lib/ :

Code: Pascal  [Select][+][-]
  1. -k"-rpath=/usr/pkg/lib"
  2. -k"-rpath=/usr/X11R7/lib"

 ;D
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018