-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Labels
good 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
In version 10.0.0 of ffigen the following feature was implemented:
"When generating typedefs for Pointer<NativeFunction<Function>>, also generate a typedef for the Function."
It would be great if this would work for typedefs for NativeFunction<Function> as well.
Example:
typedef void (*list_callback)( string_list_t *list );
void test_list( list_callback callback );
ffigen generates:
typedef list_callback = ffi.Pointer<ffi.NativeFunction<list_callbackFunction>>;
typedef list_callbackFunction = ffi.Void Function(ffi.Pointer<string_list_t> list);
but for
typedef void list_callback( string_list_t *list );
void test_list( list_callback *callback );
ffigen generates:
typedef list_callback = ffi.NativeFunction<ffi.Void Function(ffi.Pointer<string_list_t> list)>;
which cannot be used with ffi.NativeCallable.
If ffigen would generate this code instead:
typedef list_callback = ffi.NativeFunction<list_callbackFunction>;
typedef list_callbackFunction = ffi.Void Function(ffi.Pointer<string_list_t> list);
Then list_callbackFunction could be used in the dart code (using NativeCallable):
late final ffi.NativeCallable<list_callbackFunction> list_callback;
...
ivanhercaz and Stumblinbear
Metadata
Metadata
Assignees
Labels
good 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