Skip to content

Commit 7382b7a

Browse files
authored
Fixup ccall docstring (#59431)
* Fix formatting * Add a compat note of Julia 1.12 to the new `gc_safe` option.
1 parent 4d7da74 commit 7382b7a

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

base/c.jl

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,11 +441,18 @@ The string literal could also be used directly before the function
441441
name, if desired `"libglib-2.0".g_uri_escape_string(...`
442442
443443
It's possible to declare the ccall as `gc_safe` by using the `gc_safe = true` option:
444+
444445
@ccall gc_safe=true strlen(s::Cstring)::Csize_t
446+
445447
This allows the garbage collector to run concurrently with the ccall, which can be useful whenever
446448
the `ccall` may block outside of julia.
447-
WARNING: This option should be used with caution, as it can lead to undefined behavior if the ccall
448-
calls back into the julia runtime. (`@cfunction`/`@ccallables` are safe however)
449+
450+
!!! warning
451+
This option should be used with caution, as it can lead to undefined behavior if the ccall
452+
calls back into the julia runtime. (`@cfunction`/`@ccallables` are safe however)
453+
454+
!!! compat "Julia 1.12"
455+
The `gc_safe` argument requires Julia 1.12 or higher.
449456
"""
450457
macro ccall(exprs...)
451458
return ccall_macro_lower((:ccall), ccall_macro_parse(exprs)...)

0 commit comments

Comments
 (0)