({{, (RefLink[ManagedLibraryExpressionID, paclet:ref/ManagedLibraryExpressionID])[expr] 
returns the positive integer ID associated with expr if it is a managed library expression and (RefLink[$Failed, paclet:ref/$Failed]) otherwise.}, {, (RefLink[ManagedLibraryExpressionID, paclet:ref/ManagedLibraryExpressionID])[expr,mname]
only returns the ID if expr is associated with the registered manager having name mname.}})

OpenersNotesSection(Spacer1)Details

A managed library expression is created with (RefLink[CreateManagedLibraryExpression, paclet:ref/CreateManagedLibraryExpression]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Load example (RefLink[LibraryFunction, paclet:ref/LibraryFunction]) objects that implement a simple linear congruential random generator:

setInstanceState = LibraryFunctionLoad["demo_managed","setInstanceState",{Integer, {Integer, 1}},"Void"];
generateFromInstance = LibraryFunctionLoad["demo_managed", "generateFromInstance",{Integer,{Integer, _}},{Real,_}];

Create an instance of a linear congruential generator:

g1=CreateManagedLibraryExpression["LCG",randomLCG]

Get its unique ID:

id = ManagedLibraryExpressionID[g1]

Set its parameters using the unique ID assigned by (RefLink[CreateManagedLibraryExpression, paclet:ref/CreateManagedLibraryExpression]):

setInstanceState[id,{1664525,1013904223,2^32,0}]

Generate two pseudorandom numbers from the instance:

generateFromInstance[id,{2}]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[CreateManagedLibraryExpression, paclet:ref/CreateManagedLibraryExpression])  ▪  (RefLink[ManagedLibraryExpressionQ, paclet:ref/ManagedLibraryExpressionQ])  ▪  (RefLink[LibraryFunction, paclet:ref/LibraryFunction])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[LibraryLink User Guide, paclet:LibraryLink/tutorial/Overview])}, {▪(RefLinkPlain[Library Callback Functions, paclet:LibraryLink/tutorial/InteractionWithWolframLanguage#894022691])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Wolfram LibraryLink, paclet:guide/LibraryLink])}})}})