Firebird - status update (not ready yet)

Lionel Elie Mamane lionel at mamane.lu
Sun Aug 14 11:09:50 UTC 2016


On Fri, Aug 12, 2016 at 11:09:38PM +0200, Bunth Tamás wrote:

>> On MacOS X, when A is dynamically linked with B (that is at build
>> time), the "install path" of B is recorded into A (more precisely,
>> into the result of linking A with B), so that at runtime (link
>> before the executable is run, not dlopen()), B is searched for B's
>> "install path".

>> So they are kind of opposite concepts, and not in the same case:
>> one for dlopen(), the other for dynamic linking. Runtime vs build
>> time.

> IIUC you are referring to a "dependent library", which is linked at
> build time, but the actual case is a "runtime loaded library".[1]

Yes, that is the name that Apple documentation gives these things.

> So it works similarly as the linux dlopen, except that there is no
> working "-rpath" option, and no "$ORIGIN".

> The solenv/bin/macosx-change-install-names tool is used to handle
> dependent libraries, using "otool -L" to track dependencies, but in
> case of a runtime loaded library, the dependency cannot be tracked
> before runtime, so it doesn't show up for "otool -L", thus this tool
> cannot be used.

Yes, that's my understanding.

> It seems, I can use dylib tokens like
> "@loader_path/libEngine12.dylib" in the string passed to dlopen.

I don't know. I don't find a reference online that says that dlopen
understands those tokens. Did you find some documentation that says it
does? I see it only referenced about dependent libraries.

What we could conceptually do is something like:

 OUString sLibURL("$LO_LIB_DIR");
 ::rtl::Bootstrap::expandMacros(sLibURL);
 OUString sEnginePath;
 ::osl::FileBase::getSystemPathFromFileURL(sLibURL + "/libEngine12.dylib", sEnginePath);
 dlopen(OUStringToOString(sEnginePath, RTL_TEXTENCODING_UTF8).getStr());

But the expandMacros and getSystemPathFromFileURL has to be done from
libreoffice code, while the dlopen is done from firebird code... That
could be a difficulty... A somewhat hackish solution is that
libreoffice code sets some environmental variable (or ... horror of
horrors ... a global variable) that the firebird code reads. <shrug>

-- 
Lionel


More information about the LibreOffice mailing list