Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Sending function pointers to XS

3 views
Skip to first unread message

Kartik Thakore

unread,
Nov 10, 2009, 5:57:56 PM11/10/09
to bla...@gmail.com, sdl-...@perl.org
Hi,
How does one send sub pointers to XS as function pointer?

The funtion I am trying to bind is


http://www.libsdl.org/cgi/docwiki.cgi/SDL_SetEventFilter

One of the paramater requires a function in the format of

int typedef (SDL_EventFilter *)(const SDL_Event * Event)


What we would like to do is send something like

SDL::Events::set_event_filter( \sub {} );


Kartik Thakore

Blabos de Blebe

unread,
Nov 11, 2009, 8:32:57 AM11/11/09
to Kartik Thakore, sdl-...@perl.org
Hi,

Unfortunately I cannot give you a full answer now (time
constraints...), but into the book below on page 202, section 6.7,
there is an brief introduction of how manage callbacks. There are also
some pitfalls. Good luck!

Later I will try to build a better answer.

http://www.manning.com/jenness/

Blabos

Kartik Thakore

unread,
Nov 11, 2009, 9:44:29 PM11/11/09
to Blabos de Blebe, sdl-...@perl.org
HI Blabos

Ok! I tried this here. But I need some review on the code. I don't think I
am doing the SDL_Event argument in properly.

http://github.com/kthakore/SDL_perl/commit/633f388bbc161bfc5177fb49e482c8cfb27b60aa

Regards
Kartik Thakore

Kartik Thakore

unread,
Nov 12, 2009, 10:43:21 AM11/12/09
to Kartik Thakore, Blabos de Blebe, sdl-...@perl.org
Ok! I have a better version. This works now but it segfaults because
it is freeing from the wrong pool.

http:://bit.ly/1eEk9C

Kartik Thakore

On 11-Nov-09, at 9:44 PM, Kartik Thakore <thakore...@gmail.com>

Kartik Thakore

unread,
Nov 12, 2009, 10:48:59 AM11/12/09
to Blabos de Blebe, sdl-...@perl.org

> Ok! I have a better version. This works now but it segfaults because
> it is freeing from the wrong pool.

Woops extra colon fixed it now.

0 new messages