Module wolfram_library_link::managed
source · Expand description
Managed expressions.
Managed expressions are Wolfram Language expressions created using
CreateManagedLibraryExpression
WL,
which are associated with a unique Id
number that is shared with a loaded library.
Using register_library_expression_manager()
, a library can register a callback
function, which will recieve a ManagedExpressionEvent
each time a new managed
expression is created or deallocated.
The managed expression Create(Id)
event is
typically handled by the library to create an instance of some library data type that
is associated with the managed expression. When the managed expression is finally
deallocated, a Drop(Id)
event is generated, and
the library knows it is safe to free the associated data object.
In this way, managed expressions allow memory-management of Rust objects to be performed indirectly based on the lifetime of a Wolfram Language expression.
Related links
- Managed Library Expressions section of the LibraryLink documentation.
- The wolfram-library-link managed expressions example.
Enums
- Lifecycle events triggered by the creation and deallocation of managed expressions.
Functions
- Register a new callback function for handling managed expression events.
Type Aliases
- Unique identifier associated with an instance of a managed library expression.