Function Not Found

What could cause a function not found error in a soft declare when I’m 100% of the parameters and function name?

I have a dylib that a new version doesn’t work, although it does in XCode. I’ve had the older dylib function for years.

Is there something in the compiler that could “break” comparability with Xojo?



Maybe use a CopyFile step for debugging?

I’m not sure I understand what you mean.

I was just asking if you are getting the error while debugging?

Oh, yes.
And I am using a copy file step to move the lib into the right place.
If I drop the old dylib into the project it all comes to life - so I know all other things are equal. I’m sure it’s something in the XCode build settings, but I’m not familiar enough to say what.


ok well you have the copy handled :slight_smile:

I’m not familiar enough with Xcode to be of anymore help :frowning:

I’m sure someone with more expertise will chime in soon

Thanks for trying.

Are change notes on the library available where you might figure out what’s going wrong?

I know one of the things that can go wrong is the paths to dependencies, I’m not sure how to explain it. There was a lot of googling and advice involved with getting the OpenSSL library to play friendly within an app.

@Norman Palardy might have better insight.

I’ve looked at the change logs. Nothing I can see should cause this.
I have to believe it’s a dependency issue I’m just not aware of.

This technical deep dive has information collected on the topic:

This article is a huge technical insight into fixing iPhoto et all for Catalina, but has a major portion about dylib stuff. Jump down to Step 2 / name_tool for where I started with OpenSSL.

Edit: It covers extracting the dylib and changing the path, which is what I needed. It’s not super detailed on what’s actually going on, I must have read about that elsewhere.

for dylibs, check with “otool -l” the list of dependencies of your libraries.

Christian, I did and everything seems to be there.

If all the paths point to valid locations, my suggestion probably becomes irrelevant.

I was pouring through that. Thanks for the heads up!

Have you confirmed that the new dylib is 64 bit (I assume the app is also)?

Julian, I have. All 64bit.

If anyone thinks they are savvy enough to solve this in an hour for $ contact me privately and we can make arrangements.

You can load dylib with SoftDeclareMBS class and look on the error message.

The hardened runtime usually blocks loading of dylibs not signed by same certificate as app.

There is no error message property. There is an error code property but no listing of what they mean.
What does -1 mean?

A very old class. Way before we had soft declares in Xojo.

Check Liberror property after calling LoadDylib method.

Seems like we got it fixed for @Chris Halford with using SoftDeclareMBS to load a dependency first:

[code]Dim f As FolderItem = app.ExecutableFile.parent.Child(“libOther.dylib”)
Dim s2 As New SoftDeclareMBS
If s2.LoadDylib(f.NativePath) Then
MsgBox “OK”
MsgBox s2.Liberror
End If

Soft Declare Function testFunction Lib MyLib ( s As cString) As Integer
Dim h As Integer = testFunction( “test” )

If h <> 0 Then
MsgBox "Success "+str(h)
MsgBox “Failed”
End If[/code]

So when loading the second lib, there is already the first one loaded and initialized and it works.