-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to handle variable number of arguments? #238
Comments
This is not yet supported in |
@dcharkes any update on this, now that dart-lang/sdk#38578 has been completed? |
I see that 79e845f was done but it seems to not work. int fcntl (int __fd, int __cmd, ...); int fcntl(
int __fd,
int __cmd,
) {
return _fcntl(
__fd,
__cmd,
);
}
late final _fcntlPtr =
_lookup<ffi.NativeFunction<ffi.Int Function(ffi.Int, ffi.Int)>>('fcntl');
late final _fcntl = _fcntlPtr.asFunction<int Function(int, int)>(); |
If you write bindings yourself, you need to use If you want FFIgen to generate bindings, you need to configure FFIgen to do that. functions:
variadic-arguments:
myfunc:
// Native C types are supported
- [int, unsigned char, long*, float**]
// Common C typedefs (stddef.h) are supported too
- [uint8_t, intptr_t, size_t, wchar_t*]
// Structs/Unions/Typedefs from generated code or a library import can be referred too.
- [MyStruct*, my_custom_lib.CustomUnion] Since the feature is implemented, and was tracked by #497, I'll close this as duplicate issue. Please file a new issue if you're having issues with |
The C library function I want to bind has some variable number of parameters, ffigen doesn't seem to handle this situation very well, is there any way?
for example:
The text was updated successfully, but these errors were encountered: