Enumeration FFIType

Enumeration Members

bool: 11

Booelan value

Must be true or false. 0 and 1 type coercion is not supported.

In C, this corresponds to:

bool
_Bool
char: 0
cstring: 14

When used as a returns, this will automatically become a CString.

When used in args it is equivalent to pointer

double: 9

Doubles are not supported yet!

f32: 10

Floats are not supported yet!

f64: 9

Doubles are not supported yet!

float: 10

Floats are not supported yet!

i16: 3

16-bit signed integer

Must be a value between -32768 and 32767

When passing to a FFI function (C ABI), type coercion is not performed.

In C:

in16_t
short // on arm64 & x64

In JavaScript:

var num = 0;
i32: 5

32-bit signed integer

Alias of int32_t

i64: 7

i64 is a 64-bit signed integer

This is not implemented yet!

i64_fast: 15

Attempt to coerce BigInt into a Number if it fits. This improves performance but means you might get a BigInt or you might get a number.

In C, this always becomes int64_t

In JavaScript, this could be number or it could be BigInt, depending on what value is passed in.

i8: 1

8-bit signed integer

Must be a value between -127 and 127

When passing to a FFI function (C ABI), type coercion is not performed.

In C:

signed char
char // on x64 & aarch64 macOS

In JavaScript:

var num = 0;
int: 5

32-bit signed integer

The same as int in C

int
int16_t: 3

16-bit signed integer

Must be a value between -32768 and 32767

When passing to a FFI function (C ABI), type coercion is not performed.

In C:

in16_t
short // on arm64 & x64

In JavaScript:

var num = 0;
int32_t: 5

32-bit signed integer

int64_t: 7

int64 is a 64-bit signed integer

This is not implemented yet!

int8_t: 1

8-bit signed integer

Must be a value between -127 and 127

When passing to a FFI function (C ABI), type coercion is not performed.

In C:

signed char
char // on x64 & aarch64 macOS

In JavaScript:

var num = 0;
pointer: 12

Pointer value

alias of ptr

ptr: 12

Pointer value

See Bun.FFI.ptr for more information

In C:

void*

In JavaScript:

ptr(new Uint8Array(1))
u16: 4

16-bit unsigned integer

Must be a value between 0 and 65535, inclusive.

When passing to a FFI function (C ABI), type coercion is not performed.

In C:

uint16_t
unsigned short // on arm64 & x64

In JavaScript:

var num = 0;
u32: 6

32-bit unsigned integer

Alias of uint32_t

u64: 8

64-bit unsigned integer

This is not implemented yet!

u64_fast: 16

Attempt to coerce BigInt into a Number if it fits. This improves performance but means you might get a BigInt or you might get a number.

In C, this always becomes uint64_t

In JavaScript, this could be number or it could be BigInt, depending on what value is passed in.

u8: 2

8-bit unsigned integer

Must be a value between 0 and 255

When passing to a FFI function (C ABI), type coercion is not performed.

In C:

unsigned char

In JavaScript:

var num = 0;
uint16_t: 4

16-bit unsigned integer

Must be a value between 0 and 65535, inclusive.

When passing to a FFI function (C ABI), type coercion is not performed.

In C:

uint16_t
unsigned short // on arm64 & x64

In JavaScript:

var num = 0;
uint32_t: 6

32-bit unsigned integer

The same as unsigned int in C (on x64 & arm64)

C:

unsigned int

JavaScript:

ptr(new Uint32Array(1))
uint64_t: 8

64-bit unsigned integer

This is not implemented yet!

uint8_t: 2

8-bit unsigned integer

Must be a value between 0 and 255

When passing to a FFI function (C ABI), type coercion is not performed.

In C:

unsigned char

In JavaScript:

var num = 0;
void: 13

void value

void arguments are not supported

void return type is the default return type

In C:

void

Generated using TypeDoc