![]() |
LibraryLink Utilities
3.0.1
Modern C++ wrapper over LibraryLink and WSTP
|
Small collection of macros designed to reduce the amount of boilerplate code and to work around certain MSVC bug. Defined in a separate header file to limit their scope. Use those macros only for interface functions (functions that will be loaded with LibraryFunctionLoad). More...
Small collection of macros designed to reduce the amount of boilerplate code and to work around certain MSVC bug. Defined in a separate header file to limit their scope. Use those macros only for interface functions (functions that will be loaded with LibraryFunctionLoad).
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Macros | |
| #define | LIBRARY_LINK_FUNCTION(name) |
| This macro forward declares and begins the definition of an extern "C" LibraryLink function with given name. More... | |
| #define | LIBRARY_WSTP_FUNCTION(name) |
| This macro forward declares and begins the definition of an extern "C" LibraryLink function with given name, which uses WSTP to exchange data with WolframLanguage. More... | |
| #define | LLU_LIBRARY_FUNCTION(name) |
| This macro provides all the boilerplate code needed for a typical exception-safe LibraryLink function. More... | |
| #define | LLU_WSTP_FUNCTION(name) |
| #define LIBRARY_LINK_FUNCTION | ( | name | ) |
This macro forward declares and begins the definition of an extern "C" LibraryLink function with given name.
For input parameter and return type explanation see the official LibraryLink guide. WolframLibraryData parameter is marked [[maybe_unused]] because it is a common workflow to take the instance of WolframLibraryData passed to WolframLibrary_initialize function and store it with LLU::LibraryData::setLibraryData so that it is accessible everywhere. With such setup one does not need to use the WolframLibraryData copy provided to every LibraryLink function.
| #define LIBRARY_WSTP_FUNCTION | ( | name | ) |
This macro forward declares and begins the definition of an extern "C" LibraryLink function with given name, which uses WSTP to exchange data with WolframLanguage.
For input parameter and return type explanation see the official LibraryLink guide. WolframLibraryData parameter is marked [[maybe_unused]] because it is a common workflow to take the instance of WolframLibraryData passed to WolframLibrary_initialize function and store it with LLU::LibraryData::setLibraryData so that it is accessible everywhere. With such setup one does not need to use the WolframLibraryData copy provided to every LibraryLink function.
| #define LLU_LIBRARY_FUNCTION | ( | name | ) |
This macro provides all the boilerplate code needed for a typical exception-safe LibraryLink function.
LLU_LIBRARY_FUNCTION(MyFunction) defines a LibraryLink function MyFunction and a regular function impl_MyFunction of type void(LLU::MArgumentManager&), which is the one you need to provide a body for. All LLU::LibraryLinkError exceptions thrown from impl_MyFunction will be caught and the error code returned to LibraryLink. All other exceptions will also be caught and translated to a FunctionError.
| #define LLU_WSTP_FUNCTION | ( | name | ) |