• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #![allow(
2     dead_code,
3     non_snake_case,
4     non_camel_case_types,
5     non_upper_case_globals
6 )]
7 
8 extern crate libloading;
9 pub struct TestLib {
10     __library: ::libloading::Library,
11     pub foo: unsafe extern "C" fn(
12         x: ::std::os::raw::c_int,
13         y: ::std::os::raw::c_int,
14     ) -> ::std::os::raw::c_int,
15     pub baz: unsafe extern "C" fn() -> ::std::os::raw::c_int,
16 }
17 impl TestLib {
new<P>(path: P) -> Result<Self, ::libloading::Error> where P: AsRef<::std::ffi::OsStr>,18     pub unsafe fn new<P>(path: P) -> Result<Self, ::libloading::Error>
19     where
20         P: AsRef<::std::ffi::OsStr>,
21     {
22         let library = ::libloading::Library::new(path)?;
23         Self::from_library(library)
24     }
from_library<L>( library: L, ) -> Result<Self, ::libloading::Error> where L: Into<::libloading::Library>,25     pub unsafe fn from_library<L>(
26         library: L,
27     ) -> Result<Self, ::libloading::Error>
28     where
29         L: Into<::libloading::Library>,
30     {
31         let __library = library.into();
32         let foo = __library.get(b"foo\0").map(|sym| *sym)?;
33         let baz = __library.get(b"baz\0").map(|sym| *sym)?;
34         Ok(TestLib {
35             __library,
36             foo,
37             baz,
38         })
39     }
40     #[must_use]
41     /// @brief A function
42     ///
43     /// @param x
44     /// @param y
45     /// @return int
foo( &self, x: ::std::os::raw::c_int, y: ::std::os::raw::c_int, ) -> ::std::os::raw::c_int46     pub unsafe fn foo(
47         &self,
48         x: ::std::os::raw::c_int,
49         y: ::std::os::raw::c_int,
50     ) -> ::std::os::raw::c_int {
51         (self.foo)(x, y)
52     }
baz(&self) -> ::std::os::raw::c_int53     pub unsafe fn baz(&self) -> ::std::os::raw::c_int {
54         (self.baz)()
55     }
56 }
57