FunctionNotFoundException?

  1. 9 weeks ago

    Hi, So my question is how can one tell if the difference if the dylib is being found or the function can not be reconciled from the dylib? I noticed in the docs that MacOS Declares are all "Soft" regardless of how declared so I tried changing the dylib name to nonesense and go tthe same errors.

    I have been working with a Win DLL (of my own) successfully by using a build CopyFileScript to load into the app parent folder for both run time and debug. I set up the same thing for Mac but I am getting a "FunctionNotFoundException" with a reason of "Could not load InitMyDLL from "hardpath" " where hard path is my hard path to the dll - after reading some here about the framework location and the debug difficulties with getting it copied into the righ tlocation just figured that would be easiest to start.

  2. Norman P

    Jul 17 Pre-Release Testers, Xojo Pro great-white-software.com/blog
    Edited 9 weeks ago
    1. make sure you copy the dylib into the Frameworks dir of the app (CopyFile steps can do this)
    2. make sure your path to the dylib is "executable relative" so it works regardless

    this means making your path to the dylib like

        @executable_path/../Frameworks/<name of my dylib here>
      

    (pretty sure I have that path right but this is a forum post so it may not have enough .. in it)
    make sure the spelling is absolutely correct in case etc as this will affect your app on case sensitive file systems

    that should at least make sure the dylib is in the right spot

    then whern you run your app and get to the point where the dylib method _should_ be called you should get either a dll load failure message (possibly in the Console log) OR the function not found which would mean the dylib loads but the function isnt exported the way you expected

    EDIT : there are other notes & advice you might check like
    https://forum.xojo.com/conversation/post/309946

    a search for "executable_path" will find a lot of comments, questions & answer related to loading dylibs on macOS

  3. Tim J

    Jul 17 Pre-Release Testers, Xojo Pro Dehydrating in AZ

    You did rebuild your DLL as a standard PIC dylib for the Mac, right? The Mac won't load Windows DLLs.

  4. Norman P

    Jul 17 Pre-Release Testers, Xojo Pro great-white-software.com/blog

    @Tim J You did rebuild your DLL as a standard PIC dylib for the Mac, right? The Mac won't load Windows DLLs.

    I skipped asking that painfully obvious one :P
    That should be a given

  5. @Tim - yes, I did. thanks. Well the developer im working with did.
    @Norm - I did that and it still gave the error so I am guessing the dylib is not correctly exporting. Still, it would be nice to know if the lib is found and thats the case... I also created a test lib (http://www.realsoftwareblog.com/2011/12/how-to-create-dylib-on-mac-os-x-and.html ) and checked the exports in terminal using nm -g and the eports are there. That works perfectly, as expected so it must be the exports in my dev's dylib.
    Thank you both very kindly for the thoughtful help!!!

  6. one thing that may be of use to others is the path was just a simple "../Frameworks/myLib.dylib" it didnt work with the "@executable_path/" but I may have been doing wrong...

  7. Norman P

    Jul 18 Pre-Release Testers, Xojo Pro great-white-software.com/blog

    @executable_path/../Frameworks/myLib.dylib should be correct

or Sign Up to reply!