next | previous | forward | backward | up | top | index | toc | Macaulay2 website
ForeignFunctions :: * voidstar = Thing

* voidstar = Thing -- assign value to object at address

Synopsis

Description

Assign the value val to an object at the address given by ptr.

i1 : x = int 5

o1 = 5

o1 : ForeignObject of type int32
i2 : ptr = address x

o2 = 0x7fbf8ea7d000

o2 : Pointer
i3 : *ptr = int 6

o3 = 0x7fbf8ea7d000

o3 : Pointer
i4 : x

o4 = 6

o4 : ForeignObject of type int32

If val is not a ForeignObject, then foreignObject is called first.

i5 : *ptr = 7

o5 = 0x7fbf8ea7d000

o5 : Pointer
i6 : x

o6 = 7

o6 : ForeignObject of type int32

Make sure that the memory at which ptr points is properly allocated. Otherwise, segmentation faults may occur!

Ways to use this method: