1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*!
# Bundled fluidlite library

This crate provides bundled [fluidlite](https://github.com/katyo/fluidlite) C library
for using with [__fluidlite__](https://crates.io/crates/fluidlite) crate in case
when system-wide library is not available.

## Usage

You can simply add this as dependency to your manifest:

```toml
[dependencies]
fluidlite = "^0.1"

# Use bundled library to avoid unresolved links
fluidlite-lib = "^0.1"
```

Next you should say compiler that you want to use that crate:

```rust
// Either in traditional manner
extern crate fluidlite_lib;

// Or in Rust2018 manner
use fluidlite_lib as _;
```

## Features

You can apply some customizations to library using those features:

- __shared__ Force bundle shared (or dynamic) library instead of static
- __with-sf3__ Enable SoundFont3 support which requires ogg/vorbis (system or bundled)
- __with-stb__ Use __stb-vorbis__ instead of Xiph's libogg/libvorbis

 */

#[cfg(test)]
mod tests {
    use std::{
        mem::MaybeUninit,
        os::raw::c_int,
    };

    extern "C" {
        pub fn fluid_version(
            major: *mut c_int,
            minor: *mut c_int,
            micro: *mut c_int,
        );
    }

    #[test]
    fn library_version() {
        let mut major = MaybeUninit::<i32>::uninit();
        let mut minor = MaybeUninit::<i32>::uninit();
        let mut micro = MaybeUninit::<i32>::uninit();

        unsafe { fluid_version(major.as_mut_ptr(), minor.as_mut_ptr(), micro.as_mut_ptr()); }

        let version = unsafe { [major.assume_init(), minor.assume_init(), micro.assume_init()] };

        assert_eq!(&version, &[1, 2, 0]);
    }
}