Skip to content

Commit 850e1cf

Browse files
authored
Merge pull request #1781 from HosseinAssaran/patch-4
Update example in ffi.md to make it compatible with both Windows OS and Unit-type systems
2 parents afffd5b + 1136074 commit 850e1cf

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/std_misc/ffi.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ attribute containing the name of the foreign library.
88
use std::fmt;
99
1010
// this extern block links to the libm library
11+
#[cfg(target_family = "windows")]
12+
#[link(name = "msvcrt")]
13+
extern {
14+
// this is a foreign function
15+
// that computes the square root of a single precision complex number
16+
fn csqrtf(z: Complex) -> Complex;
17+
18+
fn ccosf(z: Complex) -> Complex;
19+
}
20+
#[cfg(target_family = "unix")]
1121
#[link(name = "m")]
1222
extern {
1323
// this is a foreign function

0 commit comments

Comments
 (0)