system/ctypes (original) (raw)

Source Edit

Some type definitions for compatibility between different backends and platforms.

Types

BiggestFloat = float64

is an alias for the biggest floating point type the Nim compiler supports. Currently this is float64, but it is platform-dependent in general.Source Edit

BiggestInt = int64

is an alias for the biggest signed integer type the Nim compiler supports. Currently this is int64, but it is platform-dependent in general.Source Edit

BiggestUInt = uint64

is an alias for the biggest unsigned integer type the Nim compiler supports. Currently this is uint64, but it is platform-dependent in general.Source Edit

ByteAddress {....deprecated: "use uint".} = int

Deprecated: use `uint`

is the signed integer type that should be used for converting pointers to integer addresses for readability.Source Edit

clong = ClongImpl

Represents the C long type, used for interoperability.

Its purpose is to match the C long for the target platform's Application Binary Interface (ABI).

Typically, the compiler resolves it to one of the following Nim types based on the target:

**Warning:**The underlying Nim type is an implementation detail and should not be relied upon.

Source Edit

clongdouble {.importc: "long double", nodecl.} = BiggestFloat

This is the same as the type long double in C. This C type is not supported by Nim's code generator.Source Edit

cschar {.importc: "signed char", nodecl.} = int8

This is the same as the type signed char in C.Source Edit

cstringArray {.importc: "char**", nodecl.} = ptr UncheckedArray[cstring]

This is binary compatible to the type char** in C. The array's high value is large enough to disable bounds checking in practice. Use cstringArrayToSeq proc to convert it into a seq[string].Source Edit

cuchar {.importc: "unsigned char", nodecl, ...deprecated: "Use char or uint8 instead".} = char

Deprecated: Use `char` or `uint8` instead

Source Edit

cuint {.importc: "unsigned int", nodecl.} = uint32

This is the same as the type unsigned int in C.Source Edit

culong = CulongImpl

Represents the C unsigned long type, used for interoperability.

Its purpose is to match the C unsigned long for the target platform's Application Binary Interface (ABI).

Typically, the compiler resolves it to one of the following Nim types based on the target:

**Warning:**The underlying Nim type is an implementation detail and should not be relied upon.

Source Edit

cushort {.importc: "unsigned short", nodecl.} = uint16

This is the same as the type unsigned short in C.Source Edit

PFloat32 {....deprecated: "use ptr float32".} = ptr float32

Deprecated: use `ptr float32`

An alias for ptr float32.Source Edit

PFloat64 {....deprecated: "use ptr float64".} = ptr float64

Deprecated: use `ptr float64`

An alias for ptr float64.Source Edit

PInt32 {....deprecated: "use ptr int32".} = ptr int32

Deprecated: use `ptr int32`

An alias for ptr int32.Source Edit

PInt64 {....deprecated: "use ptr int64".} = ptr int64

Deprecated: use `ptr int64`

An alias for ptr int64.Source Edit