Skip to content

Commit

Permalink
Update example in ffi.md to make it compatible with both Windows OS a…
Browse files Browse the repository at this point in the history
…nd Unit-type systems
  • Loading branch information
HosseinAssaran authored Dec 11, 2023
1 parent 933c339 commit 1136074
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 1136074

Please sign in to comment.