ABI
Every function must use the C ABI as a common interface.
Argument passing
Scalars
Scalars are bound 1-to-1
Type |
Convention |
C++ Type |
Internal C type |
|---|---|---|---|
Scalar |
Copy |
|
|
Ref { Scalar } |
Address to the scalar |
|
|
Ptr { Scalar } |
Copy of the address |
|
|
Ref { Ptr { Scalar } } |
Address to copy of the pointer |
|
|
Classes
Classes are bound as class wrappers around a dynamically allocated internal object from the source
Type |
Convention |
C++ |
Internal C type |
|---|---|---|---|
Class |
Address of the internal object |
|
|
Ref { Class } |
Address of the internal object |
|
|
Ptr { Class } |
Address of the internal object |
|
|
Ref { Ptr { Class } } |
Address to copy of the pointer to the internal object |
|
|
Strings and arrays
Strings and arrays have an inlined structure holding information about the array: address, bounds,…
Type |
Convention |
C++ Type |
Internal C type |
|---|---|---|---|
Array |
Copy of the array data |
|
|
Ptr { Array } |
Copy of the array data |
|
|
Ref { Array } |
Copy of the array data |
|
|
Ref { Ptr { Array } } |
Address to copy of the array data |
|
|
Pointers
Pointers to pointers are not supported.
References
References cannot be contained inside other type (Ptr { Ref {} }) as
they are implementation defined.
Returning values
Scalars
Type |
Convention |
C++ Type |
Internal C type |
|---|---|---|---|
Scalar |
Copy |
|
|
Ref { Scalar } |
Address to the scalar |
|
|
Ptr { Scalar } |
Copy of the address |
|
|
Classes
Classes (and arrays) use a view type to return them as a reference
in order to avoid returning an object whose lifetime depends on the
stack. View types can be copied and hold no ownership on the pointer to
the internal data. They do not free anything when they are destroyed.
Type |
Convention |
C++ Type |
Internal C type |
|---|---|---|---|
Class |
Address of the internal object |
|
|
Ptr { Class } |
Address of the internal object |
|
|
Ref { Class } |
Address of the internal object |
|
|
Strings and arrays
Type |
Convention |
C++ Type |
Internal C type |
|---|---|---|---|
Array |
Copy of the array data |
|
|
Ptr { Array } |
Copy of the array data |
|
|
Ref { Array } |
Copy of the array data |
|
|
Ref to Pointers
Cannot be returned.