File tree 1 file changed +13
-4
lines changed
1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -193,10 +193,19 @@ sig
193
193
{!string} are copied into immovable C-managed storage before being passed
194
194
to C.
195
195
196
- When the memory is not owned by the C code, -- i.e. when creating or
197
- initializing a struct in OCaml before passing it to C -- then the
198
- {!string} view isn't a good choice, because there's no way to manage the
199
- lifetime of the C copy of the generated OCaml string.
196
+ The string type representation is suitable for use in function argument
197
+ types such as the following:
198
+
199
+ [string @-> returning int]
200
+
201
+ where the lifetime of the C-managed storage does not need to extend beyond
202
+ the duration of the function call. However, it is not suitable for
203
+ use in struct or union fields
204
+
205
+ [field s "x" string]
206
+
207
+ because it does not provide a way to manage the lifetime of the
208
+ C-managed storage.
200
209
*)
201
210
202
211
val string_opt : string option typ
You can’t perform that action at this time.
0 commit comments