Many internal calls boil down to invocations like

LibraryFunction["path/to/library", "funcName" , ...]

I'm on a mac, so I can use the nm command in the terminal to reveal the list of available functions. Take, for instance, the ZMQ library for network calls:

lib = "/Applications/Mathematica.app/Contents/SystemFiles/Links/ZeroMQLink/LibraryResources/MacOSX-x86-64/libzeromqlink.dylib";
RunProcess[{"nm","-gU",lib}, "StandardOutput"]

(*Out[1] = *)
00000000000060d0 T _BindZMQSocket
00000000000054f0 T _CloseZMQContext
000000000001f7e0 T _Close_SocketObject
000000000002a158 S _wrisockets_IPPROTO_UDP
000000000002a160 S _wrisockets_SOCK_DGRAM
000000000002a15c S _wrisockets_SOCK_STREAM


Is there a WL function for exploring library contents instead of RunProcess and explicitly mentioning nm or other system details?


1 Answer 1


I believe the answer is no, there is not. If you want to load a function from a library using LibraryFunctionLoad or ForeignFunctionLoad, you need to already know the name. For functions gotten by LibraryFunctionLoad, at least, you can use LibraryFunctionInformation to get the signature; for those gotten by ForeignFunctionLoad you also need to know the signature.

If you're curious, you can always use GeneralUtilities`PrintDefinitions to see the top-level implementation of a built-in function, if one exists. If instead a built-in invokes hidden downcode, this function will tell you as well.

  • $\begingroup$ I also realized that the .wl files in $InstallationDirectory<>"/SystemFiles/Links/*" are very readable as examples of library function usage. Perhaps that's what PrintDefinitions uses... $\endgroup$
    – Adam
    Commented Sep 24, 2023 at 21:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.