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

# ForeignType -- abstract foreign type

## Description

This is the abstract class from which all other foreign type classes should inherit. All ForeignType objects should have, at minimum, two key-value pairs:

- Name, a string, a human-readable name of the class for display purposes, used by net(ForeignType).
- Address, a pointer, a pointer to the corresponding ffi_type object, used by address(ForeignType).

### Menu

- size(ForeignType) -- size of a foreign type

#### Subtypes

- ForeignArrayType -- foreign array type
- ForeignIntegerType -- foreign integer type
- ForeignPointerType -- foreign pointer type
- ForeignPointerArrayType -- foreign type for NULL-terminated arrays of pointers
- ForeignRealType -- foreign real type
- ForeignStringType -- foreign string type
- ForeignStructType -- foreign struct type
- ForeignUnionType -- foreign union type
- ForeignVoidType -- foreign void type

## Types of foreign type:

- ForeignArrayType -- foreign array type
- ForeignIntegerType -- foreign integer type
- ForeignPointerArrayType -- foreign type for NULL-terminated arrays of pointers
- ForeignPointerType -- foreign pointer type
- ForeignRealType -- foreign real type
- ForeignStringType -- foreign string type
- ForeignStructType -- foreign struct type
- ForeignUnionType -- foreign union type
- ForeignVoidType -- foreign void type

## Methods that use a foreign type:

- `address(ForeignType)` -- see address -- pointer to type or object
- `foreignArrayType(ForeignType,ZZ)` -- see foreignArrayType -- construct a foreign array type
- `foreignArrayType(String,ForeignType,ZZ)` -- see foreignArrayType -- construct a foreign array type
- `ForeignType * ZZ` -- see foreignArrayType -- construct a foreign array type
- `ZZ * ForeignType` -- see foreignArrayType -- construct a foreign array type
- `foreignFunction(Pointer,String,ForeignType,VisibleList)` -- see foreignFunction -- construct a foreign function
- `foreignFunction(SharedLibrary,String,ForeignType,ForeignType)` -- see foreignFunction -- construct a foreign function
- `foreignFunction(SharedLibrary,String,ForeignType,VisibleList)` -- see foreignFunction -- construct a foreign function
- `foreignFunction(String,ForeignType,ForeignType)` -- see foreignFunction -- construct a foreign function
- `foreignFunction(String,ForeignType,VisibleList)` -- see foreignFunction -- construct a foreign function
- `foreignPointerArrayType(ForeignType)` -- see foreignPointerArrayType -- construct a foreign pointer array type
- `foreignPointerArrayType(String,ForeignType)` -- see foreignPointerArrayType -- construct a foreign pointer array type
- `foreignSymbol(SharedLibrary,String,ForeignType)` -- see foreignSymbol -- get a foreign symbol
- `foreignSymbol(String,ForeignType)` -- see foreignSymbol -- get a foreign symbol
- `net(ForeignType)`
- ForeignType * voidstar -- dereference a voidstar object
- ForeignType ForeignObject -- cast a foreign object to the given foreign type
- ForeignType Pointer -- dereference a pointer
- `getMemory(ForeignType)` -- see getMemory -- allocate memory using the garbage collector
- new ForeignType (missing documentation)
- size(ForeignType) -- size of a foreign type

## For the programmer

The object ForeignType is a type, with ancestor classes Type < MutableHashTable < HashTable < Thing.

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