Macaulay2 » Documentation
Packages » ForeignFunctions » ForeignObject » foreignSymbol
next | previous | forward | backward | up | index | toc

# foreignSymbol -- get a foreign symbol

- Usage:
    `foreignSymbol(lib, symb, T)`
    `foreignSymbol(symb, T)`
- Inputs:
  - lib, a shared library,
  - symb, a string,
  - T, a foreign type,
- Outputs:
  - a foreign object,

## Description

This function is a wrapper around the C function dlsym. It loads a symbol from a shared library using the specified foreign type. If the shared library is already linked against Macaulay2, then it may be omitted.

    i1 : foreignSymbol("errno", int)

    o1 = 0

    o1 : ForeignObject of type int32

## Ways to use foreignSymbol:

- `foreignSymbol(SharedLibrary,String,ForeignType)`
- `foreignSymbol(String,ForeignType)`

## For the programmer

The object foreignSymbol is a method function.

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/ForeignFunctions.m2:1958:0.