Calling-convention descriptor objects used in function import and export descriptors. The module exports cdecl and stdcall. Each descriptor is one object whose public field CALL supplies the calling-convention text when called.


Descriptor objects

cdecl and stdcall are callable Dict descriptors whose public CALL Block returns target-specific calling-convention Text.

Fields


cdecl

cdecl

(-- text) Produces the C calling-convention text for the current target.
  • On a target with 8-byte Natx storage, leaves known Text "". On a target with another Natx size, leaves "ccc".
  • Put cdecl in the convention field of the options descriptor passed to importFunction or exportFunction. The descriptor call supplies the field's Text value.

stdcall

stdcall

(-- text) Produces the standard-call calling-convention text for the current target.
  • On a target with 8-byte Natx storage, leaves known Text "". On a target with another Natx size, leaves "x86_stdcallcc".
  • Put stdcall in the convention field of the options descriptor passed to importFunction or exportFunction.


Descriptor use

Known issue: The convention option is accepted and is part of the Code schema, but it is not emitted in generated LLVM declarations, definitions, or calls. With -32bits, stdcall functions are declared, defined, and called without x86_stdcallcc.


Examples

One descriptor in a callable declaration

"String"      use
"control"     use
"conventions" use

addOne: {value: Int32;} Int32 {convention: cdecl;} codeRef;
[1 +] !addOne

{} Int32 {} [
  ("result=" 41 addOne LF) printList
  0
] "main" exportFunction

Expected Output

result=42

See also