View previous topic :: View next topic |
Author |
Message |
kaarna
Joined: 03 Apr 2006 Posts: 92 Location: Finland
|
Posted: Thu Jun 28, 2007 11:33 am Post subject: How to wrap extern(C) int function (GstPad*, GstCaps*) Func |
|
|
So is it at all possible to wrap this kind of functions, that don't have a gpointer user_data, that can be used for the D instance? Normally the D instance is put onto the gpointer/void* user_data argument. But what about this:
Code: | public typedef extern(C) int function (GstPad*, GstCaps*) GstPadSetCapsFunction;
public void setSetCapsFunction( int delegate(Caps) dlg )
{
onSetSetCapsListener = dlg;
gst_pad_set_setcaps_function( gstPad, callBackSetSetCaps );
}
int delegate(Caps) onSetSetCapsListener;
extern(C) static int callBackSetSetCaps(GstPad* pad, GstCaps* caps)
{
//Umm so what do I do here, as I haven't got the D instance?
//How do I call the onSetSetCapsListener?
} |
Or could there be another way? Can't find any implementions of this kind of stuff from elsewhere on gtkD.
Quick responses would be appreciated, as I'm in a hurry to do a release on 1st of July... |
|
Back to top |
|
|
Ant
Joined: 06 Mar 2004 Posts: 306 Location: Canada
|
Posted: Thu Jun 28, 2007 10:38 pm Post subject: Re: How to wrap extern(C) int function (GstPad*, GstCaps*) |
|
|
satelliittipupu wrote: | So is it at all possible to wrap this kind of functions, that don't have a gpointer user_data, that can be used for the D instance? Normally the D instance is put onto the gpointer/void* user_data argument. But what about this:
Code: | public typedef extern(C) int function (GstPad*, GstCaps*) GstPadSetCapsFunction;
public void setSetCapsFunction( int delegate(Caps) dlg )
{
onSetSetCapsListener = dlg;
gst_pad_set_setcaps_function( gstPad, callBackSetSetCaps );
}
int delegate(Caps) onSetSetCapsListener;
extern(C) static int callBackSetSetCaps(GstPad* pad, GstCaps* caps)
{
//Umm so what do I do here, as I haven't got the D instance?
//How do I call the onSetSetCapsListener?
} |
Or could there be another way? Can't find any implementions of this kind of stuff from elsewhere on gtkD.
Quick responses would be appreciated, as I'm in a hurry to do a release on 1st of July... :) |
if nothing better comes up...
int delegate(Caps) dlg[GstPad*] // or something like that - with correct D sintax
of course you'll have to manage the associative array yourself.
Ant |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|