File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -4,13 +4,14 @@ pub use self::platform::Library;
44
55#[ cfg( unix) ]
66mod platform {
7- use std:: ffi:: { CStr , c_int, c_void} ;
7+ use std:: ffi:: { CStr , c_char , c_int, c_void} ;
88
99 #[ link( name="dl" ) ]
1010 extern "C" {
1111 fn dlopen ( filename : * const i8 , flag : c_int ) -> * mut c_void ;
1212 fn dlsym ( handle : * mut c_void , symbol : * const i8 ) -> * mut c_void ;
1313 fn dlclose ( handle : * mut c_void ) -> c_int ;
14+ fn dlerror ( ) -> * const c_char ;
1415 }
1516
1617 pub struct Library ( * mut c_void ) ;
@@ -23,9 +24,13 @@ mod platform {
2324 const RTLD_NOW : c_int = 2 ;
2425 let handle = dlopen ( path. as_ptr ( ) , RTLD_NOW ) ;
2526 if handle. is_null ( ) {
27+ let cstr = dlerror ( ) ;
28+ let cstr = CStr :: from_ptr ( cstr) ;
29+ eprintln ! ( "Dlerror: {:?}" , cstr) ;
2630 None
2731 }
2832 else {
33+ eprintln ! ( "Loading worked HERE" ) ;
2934 Some ( Self ( handle) )
3035 }
3136 }
Original file line number Diff line number Diff line change @@ -125,7 +125,9 @@ fn with_lib<T, F: Fn(&Libgccjit) -> T>(callback: F) -> T {
125125pub fn load ( path : & CStr ) -> bool {
126126 let lib =
127127 LIB . get_or_init ( || {
128- unsafe { Libgccjit :: open ( path) }
128+ let lib = unsafe { Libgccjit :: open ( path) } ;
129+ eprintln ! ( "Is some: {}" , lib. is_some( ) ) ;
130+ lib
129131 } ) ;
130132 lib. is_some ( )
131133}
You can’t perform that action at this time.
0 commit comments