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

# ForeignType ForeignObject -- cast a foreign object to the given foreign type

- Operator: SPACE
- Usage:
    `T x`
- Inputs:
  - T, a foreign type,
  - x, a foreign object,
- Outputs:
  - a foreign object,

## Description

Cast the given foreign object to the given foreign type. Note that the addresses will remain the same.

    i1 : chararray4 = 4 * char'

    o1 = int8[4]

    o1 : ForeignArrayType

    i2 : x = chararray4 append(ascii "foo", 0)

    o2 = {102, 111, 111, 0}

    o2 : ForeignObject of type int8[4]

    i3 : y = charstar x

    o3 = foo

    o3 : ForeignObject of type char*

    i4 : address x === address y

    o4 = true

## Ways to use this method:

- `ForeignStructType ForeignObject`
- ForeignType ForeignObject -- cast a foreign object to the given foreign type

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