CALLBACK:
Factor handbook » C library interface » Passing data between Factor and C » C type specifiers

Prev:UNION-STRUCT:
Next:TYPEDEF:


Vocabulary
alien.syntax

Syntax
CALLBACK: return type ( parameters )


Inputs
None

Outputs
None

Word description
Defines a new function pointer C type word type. The newly defined word works both as a C type and as a wrapper for alien-callback for callbacks that accept the given return type and parameters. The ABI of the callback is decided from the ABI of the active LIBRARY: declaration.

Examples
CALLBACK: bool FakeCallback ( int message, void* payload ) : MyFakeCallback ( -- alien ) [| message payload | "message #" write message number>string write " received" write nl t ] FakeCallback ;


Definition