Re: Wrapping Callback Functions
- Posted by irv Oct 31, 2020
- 943 views
You can save some grief if you assign a type for the callbacks, so that you get notified when you try to look up an invalid c routine, otherwise, you have to check each one to see if it succeeds. Something like this, off the top of my head:
type handle(integer x) return x > -1 end type handle xNewtonAllocMemory = define_c_func(dll,"+NewtonAllocMemory",{C_INT},C_POINTER) handle xNewtonFreeMemory = define_c_proc(dll,"+NewtonFreeMemory",{C_POINTER,C_INT})