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

foreignObject -- construct a foreign object

Synopsis

Description

This function constructs a ForeignObject. The type is determined automatically based on type of the input. Integers are converted to int32 objects.

i1 : foreignObject 5

o1 = 5

o1 : ForeignObject of type int32

Non-integers are converted to double objects.

i2 : foreignObject pi

o2 = 3.14159265358979

o2 : ForeignObject of type double

Strings are converted to charstar objects.

i3 : foreignObject "Hello, world!"

o3 = Hello, world!

o3 : ForeignObject of type char*

Pointers are converted to voidstar objects.

i4 : foreignObject nullPointer

o4 = (nil)

o4 : ForeignObject of type void*

Lists are converted to foreign objects with the appropriate ForeignArrayType.

i5 : foreignObject {1, 3, 5, 7, 9}

o5 = {1, 3, 5, 7, 9}

o5 : ForeignObject of type int32[5]

No conversion is done when the input is already a foreign object.

i6 : foreignObject oo

o6 = {1, 3, 5, 7, 9}

o6 : ForeignObject of type int32[5]

Ways to use foreignObject :

For the programmer

The object foreignObject is a method function.