CreateManagedLibraryExpression

CreateManagedLibraryExpression[mname,f]
creates a managed library expression by applying f to a positive integer ID associated with a registered manager with name mname.

DetailsDetails

  • The IDs generated for the manager with name mname start at 1 and follow sequentially until the manager is unregistered.
  • A manager is registered by using the LibraryLink callback function registerLibraryExpressionManager.

ExamplesExamplesopen allclose all

Basic Examples  (1)Basic Examples  (1)

Load example LibraryFunction objects that implement a simple linear congruential random generator:

In[1]:=
Click for copyable input

Create an instance of a linear congruential generator:

In[3]:=
Click for copyable input
Out[3]=

Set its parameters using the unique ID assigned by CreateManagedLibraryExpression:

In[4]:=
Click for copyable input

Generate two pseudorandom number from the instance:

In[5]:=
Click for copyable input
Out[5]=

Set up another instance and generate three numbers from it:

In[6]:=
Click for copyable input
Out[8]=

The first instance is available until the expression is no longer referenced:

In[9]:=
Click for copyable input
Out[9]=
Introduced in 2014
(10.0)