Macaulay2 » Documentation
Packages » ForeignFunctions :: * voidstar = Thing
next | previous | forward | backward | up | index | toc

* 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 = 0x717ae64a8c10

o2 : Pointer
i3 : *ptr = int 6

o3 = 6

o3 : ForeignObject of type int32
i4 : x

o4 = 6

o4 : ForeignObject of type int32

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

i5 : *ptr = 7

o5 = 7

o5 : ForeignObject of type int32
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: