@@ -100,20 +100,26 @@ impl WglExtra {
100100 pub fn load ( ) -> Result < Self , MissingExtensionFunctionError > {
101101 unsafe {
102102 Ok ( Self {
103- wglCreateContextAttribsARB : transmute ( Self :: load_fn (
104- c"wglCreateContextAttribsARB" ,
103+ wglCreateContextAttribsARB : transmute :: < * const c_void , WglCreateContextAttribsARB > (
104+ Self :: load_fn ( c"wglCreateContextAttribsARB" ) ?,
105+ ) ,
106+ wglChoosePixelFormatARB : transmute :: < * const c_void , WglChoosePixelFormatARB > (
107+ Self :: load_fn ( c"wglChoosePixelFormatARB" ) ?,
108+ ) ,
109+ wglSwapIntervalEXT : transmute :: < * const c_void , WglSwapIntervalEXT > ( Self :: load_fn (
110+ c"wglSwapIntervalEXT" ,
105111 ) ?) ,
106- wglChoosePixelFormatARB : transmute ( Self :: load_fn ( c"wglChoosePixelFormatARB" ) ?) ,
107- wglSwapIntervalEXT : transmute ( Self :: load_fn ( c"wglSwapIntervalEXT" ) ?) ,
108112 } )
109113 }
110114 }
111115
112- fn load_fn (
113- name : & ' static CStr ,
114- ) -> Result < unsafe extern "system" fn ( ) -> isize , MissingExtensionFunctionError > {
115- unsafe { wglGetProcAddress ( name. as_ptr ( ) as * const u8 ) }
116- . ok_or_else ( || MissingExtensionFunctionError { name } )
116+ fn load_fn ( name : & ' static CStr ) -> Result < * const c_void , MissingExtensionFunctionError > {
117+ let ptr = unsafe { wglGetProcAddress ( name. as_ptr ( ) as * const u8 ) } ;
118+
119+ match ptr {
120+ Some ( ptr) => Ok ( ptr as * const c_void ) ,
121+ None => Err ( MissingExtensionFunctionError { name } ) ,
122+ }
117123 }
118124
119125 pub fn create_context_for_config (
0 commit comments