ForeignPointerLookup

ForeignPointerLookup[lib,fun]

returns the pointer to the function fun in the library lib.

Details

Examples

open allclose all

Basic Examples  (1)

Get the pointer to a function in a library:

Load the ForeignFunction by specifying an appropriate type:

Call the foreign function:

Scope  (1)

ForeignPointerLookup uses FindLibrary to locate libraries:

Alternatively, find the library once with FindLibrary and pass it to ForeignPointerLookup:

Applications  (1)

Compile a library with a function that takes a function pointer:

Load the foreign function:

Load a pointer to a function from a different library:

Pass the function pointer to the foreign function:

Read the output:

Properties & Relations  (1)

Get the pointer to a function in a library:

Load the ForeignFunction by specifying an appropriate type:

Alternatively, this can be accomplished with a single ForeignFunctionLoad call:

Possible Issues  (2)

ForeignPointerLookup will return a Failure if the library cannot be found:

ForeignPointerLookup will return a Failure if the function pointer cannot be found in the library:

Wolfram Research (2023), ForeignPointerLookup, Wolfram Language function, https://reference.wolfram.com/language/ref/ForeignPointerLookup.html.

Text

Wolfram Research (2023), ForeignPointerLookup, Wolfram Language function, https://reference.wolfram.com/language/ref/ForeignPointerLookup.html.

CMS

Wolfram Language. 2023. "ForeignPointerLookup." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ForeignPointerLookup.html.

APA

Wolfram Language. (2023). ForeignPointerLookup. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ForeignPointerLookup.html

BibTeX

@misc{reference.wolfram_2024_foreignpointerlookup, author="Wolfram Research", title="{ForeignPointerLookup}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/ForeignPointerLookup.html}", note=[Accessed: 05-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_foreignpointerlookup, organization={Wolfram Research}, title={ForeignPointerLookup}, year={2023}, url={https://reference.wolfram.com/language/ref/ForeignPointerLookup.html}, note=[Accessed: 05-November-2024 ]}