doc: document calling V from C
parent
0675079b98
commit
19c11bace9
17
doc/docs.md
17
doc/docs.md
|
@ -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
|
## Atomics
|
||||||
|
|
||||||
V has no special support for atomics, yet, nevertheless it's possible to treat variables as atomics
|
V has no special support for atomics, yet, nevertheless it's possible to treat variables as atomics
|
||||||
|
|
Loading…
Reference in New Issue