Library 'not found' when called from VBA in Excel for Mac 2016

I compiled a dylib with two simple functions using clang++ as below:

1
2
3
4
5
double sumar(double a, double b)
{ return a + b; }

double restar (double a, double b)
{ return a - b;}


The nm -g libPerson.dylib is:

0000000000000f70 T __Z5sumardd
0000000000000f90 T __Z6restardd
                 U dyld_stub_binder


Placed the .dylib file in /usr/local/lib. I called function _Z5sumardd in the library from VBA in Excel for Mac 2016 using:

Private Declare PtrSafe Function myAdd Lib "usr:local:lib:libPerson.dylib" Alias "_Z5sumardd" (ByVal a As Double, ByVal b As Double) As Double

When try testing the function in the Immediate Window I get:

Run-time Error '53': File not found: usr:local:lib:libPerson.dylib
Last edited on
Did you check whether the file does actually exist within that folder?
Yes, the file libPerson.dylib is in folder Macintosh HD⁩/usr⁩/local⁩/lib. VBA can only locate libraries in /usr/lib but this is a system folder I can't move files into. I understand it has something to do with Apple's sandbox and applications having access to only certain folders in the computer. I am using Excel for Mac version 16.20. Thank you.
Last edited on
Topic archived. No new replies allowed.