-
Notifications
You must be signed in to change notification settings - Fork 331
Types
rdp edited this page Sep 13, 2010
·
23 revisions
This page contains a canonical list of type symbols recognized by attach_function and Struct#layout
-
:char
– 8-bit character -
:uchar
– 8-bit unsigned character -
:int8
– 8-bit signed integer -
:uint8
– 8-bit unsigned integer -
:short
– 16-bit signed integer -
:ushort
– 16-bit unsigned integer -
:int16
– 16-bit signed integer -
:uint16
– 16-bit unsigned integer -
:int
– 32-bit signed integer -
:uint
– 32-bit unsigned integer -
:int32
– 32-bit signed integer -
:uint32
– 32-bit unsigned integer -
:long
– long int – platform-specific size 1 -
:ulong
– unsigned long int – platform-specific size -
:int64
– 64-bit signed integer -
:uint64
– 64-bit unsigned integer -
:long_long
– 64-bit signed integer -
:ulong_long
– 64-bit unsigned integer -
:float
– 32-bit floating point -
:double
– 64-bit floating point (double-precision) -
:pointer
– pointer – platform-specific size -
:string
– C-style (NULL-terminated) character string -
:bool
– (?? 1 byte in C++) - Enums – You can use an enum group (or its symbol) as a type
For function return type only:
-
:void
– For functions that return nothing (return type void).
For function argument type only:
-
:buffer_in
– Similar to:pointer
, but optimized for Buffers that the function can only read (not write). -
:buffer_out
– Similar to:pointer
, but optimized for Buffers that the function can only write (not read). -
:buffer_inout
– Similar to:pointer
, but may be optimized for Buffers. -
:varargs
– see examples for an example
Apparently there are most types available as well.
1 this thread explains some of the different sizes on 64 versus 32-bit, but you shouldn’t have to worry about it.