none
How to access dylib in my VBA code? RRS feed

  • Question

  • I'm searching for accessing my own .dylib in VBA code.

    I've tried to access the system lib such as 

    Private Declare Function rand CDecl Lib "libc.dylib" Alias "rand" ()
    Sub MyTest()
       Rem Hi
       rand

    End Sub 

    Although it will crash, I consider it can be successful compiled.

    And if I try to access my own dylib such as

     

    Private Declare Function myFunc CDecl Lib "/Users/Me/TestLib.dylib" Alias "myFunc" ()
    Sub MyTest()
       Rem Hi
       myFunc

     

    End Sub 

    It will occur a compile error as "can not find the path /Users/Me/TestLib.dylib".

    Did I make any mistake?

    I've try to google it but I can't find any answer. (I've found an answer told me I have to use ":" instead of "/" in the path but it didn't work.)

    Thanks for your answer.


    Monday, February 6, 2012 5:15 AM

All replies

  • The approach described in the following article does seem to work:

    http://delphihaven.wordpress.com/2011/10/17/firemonkey-forms-and-dlls/

    The secret seems to be to name the exported function "correctly", with an underscore.

    But how you create a function in (say) XCode and Objective-C or C++ on Mac that does the same thing, I don't yet know.


    Peter Jamieson

    Tuesday, March 6, 2012 7:56 PM