-
Notifications
You must be signed in to change notification settings - Fork 81
Closed
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work ongood first issueA good starting issue for contributors (issues with this label will appear in /contribute)A good starting issue for contributors (issues with this label will appear in /contribute)package:ffigen
Description
It would be nice if ffigen supported generating the code for unwrapping leaf functions. Unless I missed something I have to manually call LookupFunction with the correct type arguments.
Originally posted by @johnmccutchan in dart-lang/sdk#54465 (comment)
@johnmccutchan Would you like all arguments to be typed data? This should probably be some regex match so that one can pick and choose which functions. If we want to take it really far one might want to configure it per argument even.
functions:
leaf:
include:
# Match function name.
- 'myFunc'
# Do this to set isLeaf:true for all functions.
- '.*'
exclude:
# If you only use exclude, then everything
# not excluded is generated.
- 'dispose'
use-typed-data:
include:
# Use `TypedData` arguments for `Pointer` arguments for `myFunc`
- 'myFunc'
# Use `TypedData` arguments for `Pointer` arguments for all functions.
- '.*'
exclude:
# If you only use exclude, then everything
# not excluded is generated.
- 'dispose'
Matching functions in use-typed-data
that are not leaf is a no-op or an error.
Only arguments are typed data, return types are not.
The only types that can be unwrapped are:
int8_t
int16_t
int32_t
int64_t
uint8_t
uint16_t
uint32_t
uint64_t
float
double
Abi-specific integers are not supported.
Metadata
Metadata
Assignees
Labels
P2A bug or feature request we're likely to work onA bug or feature request we're likely to work ongood first issueA good starting issue for contributors (issues with this label will appear in /contribute)A good starting issue for contributors (issues with this label will appear in /contribute)package:ffigen