docs: add missing @ on export attributes (#21858)

This commit is contained in:
JalonSolov 2024-07-13 05:31:19 -04:00 committed by GitHub
parent 36c7910f53
commit 12dc6f3de3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 6 additions and 6 deletions

View file

@ -7443,7 +7443,7 @@ By default all V functions have the following naming scheme in C: `[module name]
For example, `fn foo() {}` in module `bar` will result in `bar__foo()`. For example, `fn foo() {}` in module `bar` will result in `bar__foo()`.
To use a custom export name, use the `[export]` attribute: To use a custom export name, use the `@[export]` attribute:
``` ```
@[export: 'my_custom_c_name'] @[export: 'my_custom_c_name']

View file

@ -549,7 +549,7 @@ pub:
is_main bool // true for `fn main()` is_main bool // true for `fn main()`
is_test bool // true for `fn test_abcde() {}`, false for `fn test_abc(x int) {}`, or for fns that do not start with test_ is_test bool // true for `fn test_abcde() {}`, false for `fn test_abc(x int) {}`, or for fns that do not start with test_
is_conditional bool // true for `[if abc] fn abc(){}` is_conditional bool // true for `[if abc] fn abc(){}`
is_exported bool // true for `[export: 'exact_C_name']` is_exported bool // true for `@[export: 'exact_C_name']`
is_keep_alive bool // passed memory must not be freed (by GC) before function returns is_keep_alive bool // passed memory must not be freed (by GC) before function returns
is_unsafe bool // true, when [unsafe] is used on a fn is_unsafe bool // true, when [unsafe] is used on a fn
is_markused bool // true, when an explicit `[markused]` tag was put on a fn; `-skip-unused` will not remove that fn is_markused bool // true, when an explicit `[markused]` tag was put on a fn; `-skip-unused` will not remove that fn

View file

@ -68,17 +68,17 @@ see also `v help build`.
bare_panic(msg string) bare_panic(msg string)
Print "V panic: " + msg, along with an optional backtrace Print "V panic: " + msg, along with an optional backtrace
and/or the V commit hash, and then exit. and/or the V commit hash, and then exit.
[export: 'malloc'] @[export: 'malloc']
__malloc(n usize) &C.void __malloc(n usize) &C.void
Allocates n bytes of memory and returns the pointer to the first Allocates n bytes of memory and returns the pointer to the first
byte. byte.
[export: 'free'] @[export: 'free']
__free(ptr &C.void) __free(ptr &C.void)
Free the block of memory ptr allocated by malloc. Free the block of memory ptr allocated by malloc.
realloc(old_area &C.void, new_size usize) &C.void realloc(old_area &C.void, new_size usize) &C.void
Allocates a new area of size new_size, copies old_area Allocates a new area of size new_size, copies old_area
to the new area, and returns a pointer to the new area. to the new area, and returns a pointer to the new area.
[export: 'calloc'] @[export: 'calloc']
__calloc(nmemb usize, size usize) &C.void __calloc(nmemb usize, size usize) &C.void
Like malloc, but sets all the bytes to `0` first. Like malloc, but sets all the bytes to `0` first.
memcpy(dest &C.void, src &C.void, n usize) &C.void memcpy(dest &C.void, src &C.void, n usize) &C.void
@ -102,7 +102,7 @@ see also `v help build`.
bare_backtrace() string bare_backtrace() string
Return a backtrace that can be printed. If backtraces are not Return a backtrace that can be printed. If backtraces are not
supported, return a message stating that backtraces do not work. supported, return a message stating that backtraces do not work.
[export: 'exit'] @[export: 'exit']
__exit(code int) __exit(code int)
Exit with code code. code is allowed to be ignored. Exit with code code. code is allowed to be ignored.