I want to call one function from a small third party dylib. The following code seems to find the dylib ok in my Frameworks folder but it always fails when trying to call the encode_file function in that last line with a Function Not Found exception and the message is Could not load encode_file from @ExecutablePath/…/Frameworks/lzss.dylib.
if LoadLibrary("lzss.dylib") = false then msgbox ("Unable to load lzss.dylib") // Call Greg's dlopen code
Soft Declare Function encode_file Lib "@ExecutablePath/../Frameworks/lzss.dylib" ( ByRef Ifile as CString, ByRef Ofile as CString ) As Integer
var Infile as CString = f.NativePath
var fTemp as folderitem = folderitem.TemporaryFile
var OutFile as CString = fTemp.NativePath
var result as integer = encode_file(Infile, Outfile)
The dylib came with a small Python script that works OK but I want to call it directly from Xojo because I don’t want all the Python dependencies.
The Arduino tools folder on GitHub includes the dylib, its C code and the Python script to call it.
After download I had to agree with several OSX security challenges before it would even allow me to use the dylib file. So I’m wondering if I need to do some sort of code signing or set entitlements before I can call functions in the dylib.
Ideas and suggestions welcome.
Thanks,
Joe