ForeignFunction
ForeignFunction[args]
represents a function that has been loaded from a library.
Details
- ForeignFunction objects are returned by functions like ForeignFunctionLoad.
- The function represented by ForeignFunction runs in the same process as the Wolfram Language kernel.
- The function represented by ForeignFunction can share data with the Wolfram Language kernel.
- The function represented by ForeignFunction is unloaded when the Wolfram Language kernel exits.
- Information for a ForeignFunction may include the following properties:
-
"ArgumentTypes" types of arguments "File" name of the library file "Function" name of the loaded function "ReturnType" return type "Type" full type "FunctionPointer" memory address - Arguments expecting a pointer type can also be passed a ManagedObject containing a pointer.
- ForeignFunction objects loaded in one kernel session may not be valid in another.
Examples
open allclose allPossible Issues (1)
ForeignFunction will return $Failed if arguments of the wrong type are passed to it:
Wolfram Research (2023), ForeignFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/ForeignFunction.html.
Text
Wolfram Research (2023), ForeignFunction, Wolfram Language function, https://reference.wolfram.com/language/ref/ForeignFunction.html.
CMS
Wolfram Language. 2023. "ForeignFunction." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ForeignFunction.html.
APA
Wolfram Language. (2023). ForeignFunction. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ForeignFunction.html