mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
docs: call_v_from_c example (#15844)
This commit is contained in:
13
examples/call_v_from_c/v_test_math.v
Normal file
13
examples/call_v_from_c/v_test_math.v
Normal file
@ -0,0 +1,13 @@
|
||||
module test_math
|
||||
|
||||
import math
|
||||
|
||||
[export: 'square']
|
||||
fn calculate_square(i int) int {
|
||||
return i * i
|
||||
}
|
||||
|
||||
[export: 'sqrt_of_sum_of_squares']
|
||||
fn calculate_sqrt_of_sum_of_squares(x f64, y f64) f64 {
|
||||
return math.sqrt(x * x + y * y)
|
||||
}
|
Reference in New Issue
Block a user