pub unsafe fn c_callback<T>(func: T) -> usize
    where T: FnMut(u64, u32, usize, usize) -> usize
{
    let trait_obj: &dyn FnMut(u64, u32, usize, usize) -> usize = &func;
    let closure_pointer_pointer: *const c_void = std::mem::transmute(&trait_obj);
    *std::mem::transmute::<_, &usize>(
        3 * std::mem::size_of::<usize>() + *std::mem::transmute::<_, &usize>(
            std::mem::size_of::<usize>() + closure_pointer_pointer as usize))
}
// **totaly not OK** and fcking unsafe stuffs .. you dont want to do it, unless you want ..
// usable for w32k callbacks and friends, as there we need to provide directly vtable->func_ptr
// so we wrap it to rust .. wonder how long this will be 'valid' lol, magic 3 ;)
totaly not OK** and fcking unsafe stuffs .. you dont want to do it, unless you want
usable for w32k callbacks and friends, as there we need to provide directly vtable->func_ptr
so we wrap it to rust .. wonder how long this will be 'valid' lol, magic 3 ;)
totaly not OK ** and fcking unsafe stuffs .. you dont want to do it unless you want usable for w32k callbacks and friends as there we need to provide directly vtable - > func_ptr so we wrap it to rust .. wonder how long this will be ' valid ' lol magic 3 ; )
pub unsafe fn c_callback<T>(func: T) -> usize
    where T: FnMut(u64, u32, usize, usize) -> usize
{
    let trait_obj: &dyn FnMut(u64, u32, usize, usize) -> usize = &func;
    let closure_pointer_pointer: *const c_void = std::mem::transmute(&trait_obj);
    *std::mem::transmute::<_, &usize>(
        3 * std::mem::size_of::<usize>() + *std::mem::transmute::<_, &usize>(
            std::mem::size_of::<usize>() + closure_pointer_pointer as usize))
}
pub unsafe fn c_callback < T > ( func : T ) -> usize where T : FnMut ( u64 , u32 , usize , usize ) -> usize { let trait_obj : & dyn FnMut ( u64 , u32 , usize , usize ) -> usize = & func ; let closure_pointer_pointer : * const c_void = std :: mem :: transmute ( & trait_obj ) ; * std :: mem :: transmute :: < _ , & usize > ( 3 * std :: mem :: size_of :: < usize > ( ) + * std :: mem :: transmute :: < _ , & usize > ( std :: mem :: size_of :: < usize > ( ) + closure_pointer_pointer as usize ) ) }
totaly not OK** and fcking unsafe stuffs .. you dont want to do it, unless you want ..
usable for w32k callbacks and friends, as there we need to provide directly vtable->func_ptr
so we wrap it to rust .. wonder how long this will be 'valid' lol, magic 3 ;)
totaly not OK ** and fcking unsafe stuffs .. you dont want to do it unless you want .. usable for w32k callbacks and friends as there we need to provide directly vtable - > func_ptr so we wrap it to rust .. wonder how long this will be ' valid ' lol magic 3 ; )
func
T
func
T