doc: document calling V from C

pull/11006/head
Alexander Medvednikov 2021-07-31 01:44:24 +03:00 committed by GitHub
parent 0675079b98
commit 19c11bace9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

View File

@ -4268,6 +4268,23 @@ fn main() {
}
```
## Calling V from C
Since V can compile to C, calling V code from C is very easy.
By default all V functions have the following naming scheme in C: `[module name]__[fn_name]`.
For example, `fn foo() {}` in module `bar` will result in `foo__bar()`.
To use a custom export name, use the `[export]` attribute:
```
[export: 'my_custom_c_name']
fn foo() {
}
```
## Atomics
V has no special support for atomics, yet, nevertheless it's possible to treat variables as atomics