[Gambas-user] Callback

tobias tobiasboe1 at ...20...
Wed Aug 10 00:56:06 CEST 2011


> hi,
>
> i wonder how one would specify a function callback to a function (i
> haven't tried anything because nothing seems to me to work). no way with
> a functions name as string and Class[name] because i can't get a pointer
> to the actual symbol via this method but only to a .Symbol object. i
> also can't call a pointer (as it would be with passing the functions
> address) or something because it is not possible to cast a pointer to a
> function... or do i miss something here?
>
> regards,
> tobi
oh, well it's possible using Object.Call(Me, name) but why isn't there 
something like a Function datatype or the possibility to call a pointer? 
is it too risky or not easily possible (just read an older post on the 
list 
(http://old.nabble.com/Signal-11-with-callback-functions-td31128062.html) which 
says that there have to be wrappers between c and gambas functions 
(something that is clear but i haven't had in mind), but the more i 
think about it late at night, the more i get the idea that this isn't 
related to my problem)
what i'd like to do is:

Public Sub test(i As Integer)
   Print i
End

Public Sub DoSomething()
   Something(5, test)
End

Public Sub Something(i As Integer, callback As Pointer)
   callback(i)
End

any ideas?




More information about the User mailing list