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

foreignSymbol -- get a foreign symbol

Synopsis

Description

This function is a wrapper around the C function dlsym. It loads a symbol from a shared library using the specified foreign type.

i1 : mps = openSharedLibrary "mps"

o1 = mps

o1 : SharedLibrary
i2 : cplxT = foreignStructType("cplx_t", {"r" => double, "i" => double})

o2 = cplx_t

o2 : ForeignStructType
i3 : foreignSymbol(mps, "cplx_i", cplxT)

o3 = HashTable{"i" => 1}
               "r" => 0

o3 : ForeignObject of type cplx_t

If the shared library is already linked against Macaulay2, then it may be omitted.

i4 : foreignSymbol("cplx_i", cplxT)

o4 = HashTable{"i" => 1}
               "r" => 0

o4 : ForeignObject of type cplx_t

Ways to use foreignSymbol :

For the programmer

The object foreignSymbol is a method function.