Vocabularyalien.syntaxSyntaxCALLBACK: return type ( parameters ) ;
Inputs and outputs| return | a C return type |
| type | a type name |
| parameters | a comma-separated sequence of type/name pairs; type1 arg1, type2 arg2, ... |
Word descriptionDefines 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.
ExamplesCALLBACK: bool FakeCallback ( int message, void* payload ) ;
: MyFakeCallback ( -- alien )
[| message payload |
"message #" write
message number>string write
" received" write nl
t
] FakeCallback ;
Definition