dart-native / dart-native/dart_native
API doesn't expose runtimeLib
- Dominant language
- C
- Stars
- 964
- Forks
- 77
- PR merge metrics
- No merged PRs in 30d
Description
I'm trying to manually call a global function and was expecting to be able to use dart-native's dynamic library ```runtimeLib```. I've realized this is not exposed in the API and am wondering how I would access dart-native's dynamic library as is. My thoughts were ```DynamicLibrary.open('dart_native.framework/dart_native'); ``` but I'm unsure as to whether I need to manually register a dealloc callback for the dynamic library in this scenario and whether my lib instance and yours would conflict.
below is all the code I'm using to access the global function. I should note, I'm getting syntax errors on this saying "Type given to lookup function must be a valid 'dart.ffi' native function type" despite CFURLRef doing nothing but extending a Struct
```class CFURLRef extends Struct{}```
It's my understanding Struct is a native type. Any thoughts as to what's going on here?
```
/// C function `CFURLCreateWithFileSystemPath`.
CFURLRef CFURLCreateWithFileSystemPath(
CFAllocatorRef arg0,
CFStringRef arg1,
CFURLPathStyle arg2,
bool arg3,
) {
return _CFURLCreateWithFileSystemPath(arg0, arg1, arg2, arg3);
}
final _CFURLCreateWithFileSystemPath_Dart _CFURLCreateWithFileSystemPath =
_dynamicLibrary.lookupFunction<_CFURLCreateWithFileSystemPath_C,
_CFURLCreateWithFileSystemPath_Dart>(
'CFURLCreateWithFileSystemPath',
);
typedef _CFURLCreateWithFileSystemPath_C = CFURLRef Function(
CFAllocatorRef arg0,
CFStringRef arg1,
CFURLPathStyle arg2,
bool arg3,
);
typedef _CFURLCreateWithFileSystemPath_Dart = CFURLRef Function(
CFAllocatorRef arg0,
CFStringRef arg1,
CFURLPathStyle arg2,
bool arg3,
);
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.