Original date:2017-03-18 17:42:12 Edited by: petelomax Subject: Re: Wrapping C Libraries callback

Icy_Viking said...
FGAPI void    FGAPIENTRY glutMouseWheelFunc( void (* callback)( int, int, int, int ) ); 

This is the actual C code. I'm sure there is a special way you need to wrap the callback pointer in there.

That translates to (obviously untested, and somewhat based on the first hit I got from google being "void glutMouseWheelFunc(void(*)(int wheel, int direction, int x, int y) callback)")

-- library code: 
constant xglutMouseWheelFunc = define_c_proc(lib,"glutMouseWheelFunc",{C_POINTER}) 
procedure glutMouseWheelFunc(atom callback) 
end procedure 
-- application code: 
function glutMouseWheelFunc_cb(integer wheel, integer direction, integer x, integer y) 
    -- do what your app must do 
end function 

Or at least that would be my first stab.

I think that in C "void(* callback)()" and "void(*)() callback" are actually exactly the same thing.


Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu