I''ve tried to distill this sample down to its smallest portion. The
problem is that the function included in the .i file can take optional
arguments, most of which are output only, except the last one, which is
input only. My target language is Ruby. When SWIG produces the wrapper
for this the input parameter''s name and type gets confused with the
second parameter''s type (relevant lines from sample.cpp):
void SwigDirector_wxWindow::GetTextExtent(wxString const &string, int
*x, int *y, int *descent, int *externalLeading, wxFont const *font) const {
VALUE obj0 = Qnil ;
VALUE obj1 = Qnil ;
VALUE result;
if (swig_get_up()) {
wxWindow::GetTextExtent(string,x,y,descent,externalLeading,font);
return;
}
obj0 = SWIG_NewPointerObj(SWIG_as_voidptr(&string),
SWIGTYPE_p_wxString, 0 );
obj1 = SWIG_NewPointerObj(SWIG_as_voidptr(x), SWIGTYPE_p_int, 0 );
result = rb_funcall(swig_get_self(), rb_intern("GetTextExtent"),
2,obj0,obj1);
obj1 should be font and its type should be SWIGTYPE_p_wxFont. I''m
using
SWIG 1.3.29 on Windows XP. Attached is the .i file. At the bottom of
the message is the command line I use with SWIG. It''s entirely
possible
I just misunderstand something about the way this is supposed to work
but I''ve pored over the help files many times.
Interestingly, if you change -ruby to -python then it appears to
correctly generate the code for obj1.
You may also want to look at my directorout typemap I''ve included which
tries to get the results from the Ruby call so it can pass them back to
the returning function if called from C++. I believe I''ve done that
part correctly but I''m always happy to be educated if I''ve
done this the
hard/wrong way
Roy
----
swig -fvirtual -w401 -w801 -w515 -c++ -ruby -o sample.cpp sample.i
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Swig-user mailing list
Swig-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swig-user