Skip to content

Commit

Permalink
Merge pull request #1781 from HosseinAssaran/patch-4
Browse files Browse the repository at this point in the history
Update example in ffi.md to make it compatible with both Windows OS and Unit-type systems
  • Loading branch information
marioidival authored Dec 13, 2023
2 parents afffd5b + 1136074 commit 850e1cf
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/std_misc/ffi.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ attribute containing the name of the foreign library.
use std::fmt;
// this extern block links to the libm library
#[cfg(target_family = "windows")]
#[link(name = "msvcrt")]
extern {
// this is a foreign function
// that computes the square root of a single precision complex number
fn csqrtf(z: Complex) -> Complex;
fn ccosf(z: Complex) -> Complex;
}
#[cfg(target_family = "unix")]
#[link(name = "m")]
extern {
// this is a foreign function
Expand Down

0 comments on commit 850e1cf

Please sign in to comment.