You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/ffi.md
+8-3Lines changed: 8 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -703,9 +703,8 @@ for more information.
703
703
704
704
## Representing opaque structs
705
705
706
-
Sometimes, a C library wants to provide a pointer to something, but not let you
707
-
know the internal details of the thing it wants. The simplest way is to use a
708
-
`void *` argument:
706
+
Sometimes, a C library wants to provide a pointer to something, but not let you know the internal details of the thing it wants.
707
+
A stable and simple way is to use a `void *` argument:
709
708
710
709
```c
711
710
voidfoo(void *arg);
@@ -774,3 +773,9 @@ Notice that it is a really bad idea to use an empty enum as FFI type.
774
773
The compiler relies on empty enums being uninhabited, so handling values of type
775
774
`&Empty` is a huge footgun and can lead to buggy program behavior (by triggering
776
775
undefined behavior).
776
+
777
+
> **NOTE:** The simplest way would use "extern types".
778
+
But it's currently (as of June 2021) unstable and has some unresolved questions, see the [RFC page][extern-type-rfc] and the [tracking issue][extern-type-issue] for more details.
0 commit comments