I used ffigen to generate bindings from a C header file.
One of the methods in C is open(const char *path)
, and ffigen generated a binding method open(ffi.Pointer<ffi.Int8> path)
.
If I want to have a dart method open(String path)
that access this binding method how can I convert the String parameter to ffi.Pointer<ffi.Int8>?
Asked
Active
Viewed 1,522 times
3

J. Gatica
- 153
- 1
- 10
1 Answers
5
Try
"Your message".toNativeUtf8().cast<Int8>()
Also see erjo's comment in https://github.com/dart-lang/ffigen/issues/72

tofutim
- 22,664
- 20
- 87
- 148