[Gambas-user] Callback

Jussi Lahtinen jussi.lahtinen at ...626...
Wed Aug 10 17:15:17 CEST 2011


You need wrapper only between C++ and Gambas, C with Gambas is fine!!
Callback functions are passed as pointer, but I have only passed gambas
written functions to external functions.

Not sure what you are doing is legitimate... Gambas should first recognize
callback pointer as function. Benoit?
However you can have desired functionality with class with special method
_call.
http://gambasdoc.org/help/lang/special/call

Jussi


On Wed, Aug 10, 2011 at 01:56, tobias <tobiasboe1 at ...20...> wrote:

>
> > 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?
>
>
> ------------------------------------------------------------------------------
> uberSVN's rich system and user administration capabilities and model
> configuration take the hassle out of deploying and managing Subversion and
> the tools developers use with it. Learn more about uberSVN and get a free
> download at:  http://p.sf.net/sfu/wandisco-dev2dev
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list