Forum > macOS / Mac OS X
How to tell LoadLibrary the path to libssl?
Fred vS:
@Josh, you are faster than me, anyway this is the same bell:
Hello.
Usually a MacOs application is encapsulated into a .app directory with some sub-directories:
The binary of the app:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---YourMacApp.app/Contents/MacOS/YourMacApp_binary
And if you have custom dependencies:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---YourMacApp.app/Resources/lib/yourdependencies.dynlib
And to load the libraries you may do something like this:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---varbinpath, libpath: string;... binPath := IncludeTrailingBackslash(ExtractFilePath(ParamStr(0)));libPath := copy(binPath, 1, length(binPath) -6) + 'Resources/lib/yourdependencies.dynlib';LoadLibrary(libPath);
anse:
I think that folder structure is quite clear, even Lazarus takes care of that when building.
The question was how to manipulate the path which a shipped third party dylib (libmysqlclient) uses when loading another third party dylib (libssl).
Thaddy:
forcedirectories?
anse:
--- Quote from: Josh on November 02, 2025, 09:04:21 pm ---Your DyLib should be in the Framworks Folder.
Note you will need to Codesign All executables,DyLib etc
--- End quote ---
In the app bundle I am now having all dylib's in the Frameworks folder. I also fixed the expected loader path by using the install_name_tool from macOS, modifying the app and all .dylib's to load dependencies from the Frameworks folder in my app bundle.
Now only TFPHttpClient still throws me an error "Could not initialize OpenSSL library" when requesting a https URL. Apparently because libssl.1.1.dylib is in the Frameworks folder, not in the app folder. Is there a way to hint the openssl units to the Frameworks folder?
Espectr0:
If I remember correctly, you need to add it to the project's linker options: “-rpath @executable_path\..\Frameworks”.
Then you use loadlibrary normally without specifying the path, just the filename.
Navigation
[0] Message Index
[#] Next page
[*] Previous page