macOS Mojave on a Parallels VM on a 2015 MBP Retina
Caveat: Not a doctor, I am a babe in the woods when it comes to macOS, so these questions might seem simplistic, I've researched and cannot find anything that answers my questions.
I have a DYLIB that is to be used with a Swift application. The Swift programmer wants the DYLIB(s) to be in the app bundle under Frameworks. He builds his DYLIBs with the output folder as follows:
@executable_path/../Frameworks/DYLIBName.dylib
Which supposedly puts the dylib into the mac bundle under Contents/Frameworks, but I am confused as to how the dylib knows which application to put itself. I know you can use Install_name_Tool as in:
install_name_tool -id @executable_path/../Frameworks/DYLIBName.dylib DYLIBName.dylib
But that isn't doing it automatically from the DYLIB build.
First things First: Just having a Framework referenced is eluding me. I have the DYLIB referenced in my code as:
const
...
...
{$IFDEF DARWIN}
DYLIBName = 'DYLIBName.dylib';
{$linkframework DYLIBName.dylib}
{$ENDIF DARWIN}
And, of course, the linker cannot find the DYLIB/Framework which is in the same folder as the application. Note I have copied the DYLIB to /System/Library/Frameworks, but it still didn't find it there.
QUESTION #1:The obvious question, then, where is the linker looking for the DYLIB using the $linkframework directive (and how do I tell the linker where to look)?
QUESTION #2:So basically how do I get application bundle/Contents/Frameworks as part of the search path. I've looked at the available Macros and there doesn't seem to be anything that is the equivalent of @executable_path/../Frameworks/.
How do I get the linker to reference the DYLIB in the app bundle (under Contents/Frameworks) ?
And as an aside, is there any Lazarus/FPC documentation WRT $linkframework and how it's supposed to work? The only reference I could find was this:
1.2.45 $LINKFRAMEWORK : Link to a framework
The {$LINKFRAMEWORK name} will link to a framework named name. This switch is available only on the Darwin platform.
Which is sort of the microsoft help solution, 100% accurate and totally useless
Again, apologies if a bit simplistic, but this is very new to me.