Boolean value
Must be true
or false
. 0
and 1
type coercion is not supported.
In C, this corresponds to:
bool
_Bool
Symbol
Boolean value
Must be true
or false
. 0
and 1
type coercion is not supported.
In C, this corresponds to:
bool
_Bool
When used as a returns
, this will automatically become a CString.
When used in args
it is equivalent to FFIType.pointer
Doubles are not supported yet!
Floats are not supported yet!
Doubles are not supported yet!
Floats are not supported yet!
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;
32-bit signed integer
Alias of FFIType.int32_t
i64 is a 64-bit signed integer
This is not implemented yet!
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.
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;
32-bit signed integer
The same as int
in C
int
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;
32-bit signed integer
int64 is a 64-bit signed integer
This is not implemented yet!
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 value
alias of FFIType.ptr
Pointer value
See Bun.FFI.ptr for more information
In C:
void*
In JavaScript:
ptr(new Uint8Array(1))
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;
32-bit unsigned integer
Alias of FFIType.uint32_t
64-bit unsigned integer
This is not implemented yet!
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.
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;
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;
32-bit unsigned integer
The same as unsigned int
in C (on x64 & arm64)
C:
unsigned int
JavaScript:
ptr(new Uint32Array(1))
64-bit unsigned integer
This is not implemented yet!
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 value
void arguments are not supported
void return type is the default return type
In C:
void