Share via

How to Access Library Function libc.dylib on Macintosh

Anonymous
2020-08-17T19:22:50+00:00

Hi - I am trying to do a Post request to a MySQL database using PowerPoint VBA on Macintosh.

I have tried using the following code, but am receiving issues in accessing the library function.

Private Declare PtrSafe Function system Lib "libc.dylib" (ByVal command As String) As Long

Function getHTTPPost(sUrl As String, sQuery As String) As Long

sCmd = "curl -v -X POST -d '" & sQuery & "' " & sUrl

exitCode = system(sCmd)

End Function

ans = getHTTPPost("http:myserver/AddNew.php?", "name=JoeBloggs&score=20")

However, this code is returning an error: File not found: libc.dylib

I did an online search and found this issue has arisen after some kind of update https://github.com/VBA-tools/VBA-Web/issues/385

The solution indicated is to set the location of the Library file name to "/usr/lib/libc.dylib". Hence I changed the line to:

Private Declare PtrSafe Function system Lib "/usr/lib/libc.dylib" (ByVal command As String) As Long

However, at the moment I continue to get the "file not found" error. I would be very grateful if anyone could tell me what the correct Mac Function Declaration is.

Thank you for any comments!

[Moved from PowerPoint/Mac/Microsoft 365 Apps or Office 365 Business]

Microsoft 365 and Office | PowerPoint | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

7 answers

Sort by: Most helpful
  1. John Korchok 232.6K Reputation points Volunteer Moderator
    2022-07-21T19:35:06+00:00

    A reply from Jamie Garroch:

    The internal macOS libraries were moved in El Capitan when Apple introduced System Integrity Protection and their aliases renamed in Big Sur. They are now declared as follows:

    Private Declare PtrSafe Function system Lib "/usr/lib/libc++.dylib" (ByVal command As String) As Long
    

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. John Korchok 232.6K Reputation points Volunteer Moderator
    2020-08-20T01:31:13+00:00

    I'm one of the rare Mac people here, and this is a subject in which I'm interested. Microsoft has duplicated many Windows-only functions in their Mac libraries. Unfortunately, they have never documented them, and from time to time, they make arbitrary changes that hose any programming you've done. There are many ways in which programming on the Mac could be opened up.

    I've created a PowerPoint User Voice suggestion that Microsoft should document these libraries to make it possible for programmers to deliver solutions to macOS clients. Please add your vote to make this suggestion more likely.: Document System Calls

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2020-08-20T00:37:52+00:00

    Hi - if this is possible I would still be very grateful to find an answer to my issue.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2020-08-17T23:04:10+00:00

    Hi - thank you for posting, however, I had read the provided link before I started this thread!

    As above I changed my path to "/usr/lib/libc.dylib", but still have the problem of the library file not being found.

    Admittedly, I know very little about using library functions with Macintosh and am hoping that someone will be knowledgeable enough to know how to correct my issue and ensure that I have defined the function as required.

    Was this answer helpful?

    0 comments No comments
  5. Steve Rindsberg 99,161 Reputation points MVP Volunteer Moderator
    2020-08-17T20:55:14+00:00

    Was this answer helpful?

    0 comments No comments