v2 / vlib / v / gen / c / testdata / export_and_weak.vv
20 lines · 16 sloc · 364 bytes · 757929392e0e7a75fc1272116460981e589737d5
Raw
1// This file tests the ability to export functions to C with a fully custom name.
2
3// It also tests, that the exported functions will be exported as weak symbols,
4// if the user tagged them as such.
5
6@[export: abcd]
7fn my_fn() int {
8 return 42
9}
10
11@[export: wxyz]
12@[weak]
13fn my_other_fn() int {
14 return 11
15}
16
17fn main() {
18 println(my_fn())
19 println(my_other_fn())
20}
21