[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: about DISOWN (Re: [Chicken-users] non-finalized object in SWIG
From: |
John Lenz |
Subject: |
Re: about DISOWN (Re: [Chicken-users] non-finalized object in SWIG |
Date: |
Fri, 30 Jun 2006 14:42:07 -0500 |
User-agent: |
Thunderbird 1.5.0.4 (X11/20060615) |
Daishi Kato wrote:
> Thanks for all those explanations.
> I now better understand some of the typemaps.
> My resolution for now is putting %apply by a script.
Note, you can run swig -xml which produces a bunch of XML describing the
.i file you input... so you could parse the -xml output to create the
%applys. That is what the xml output was really added for, modifying
the .i files from scripts.
If you didn't want to use XML, you can try the sexp which exports it in
Lisp s-expressions... then you can parse that directly in scheme. (I
think this is less tested than the xml module...)
>
> Well, so, here is another question:
> I'm wrapping the following class method, and it fails.
>
> class wxControl : public wxWindow {
> wxString& GetLabel();
> };
>
> 8<------8<------8<------8<------8<------
>
> wxchicken_core_wrap.cxx: In function 'void _wrap_wx_control_getslabel___(int,
> in
> t, int, int)':
> wxchicken_core_wrap.cxx:27542: error: invalid initialization of non-const
> refere
> nce of type 'wxString&' from a temporary of type 'wxString'
> wxchicken_core_wrap.cxx:27551: error: invalid conversion from 'const wxChar*'
> to
> 'char*'
> wxchicken_core_wrap.cxx:27551: error: initializing argument 3 of 'int
> C_string
> (int**, int, char*)'
Definatly a problem with the typemaps... just open up the
wxchicken_core_wrap.cxx file and go to that line... you should see the
code from the typemap. The second error is because C_string takes a
char *, but I assume wxString->cstr() returns a type const wxChar *....
you can just cast between them
$result = C_string (&string_space, string_len, (char *) $1->c_str());
The first I am not sure about... are you sure the GetLabel() returns a
wxString &... it looks like it returns a const wxString &... in which
case you need to declare it like
class wxControl : public wxWindow {
const wxString& GetLabel();
};
so SWIG declares the temporary variable the correct type.
You can look inside the _wrap.cxx file, it isn't that scary!
John
- Re: [Chicken-users] non-finalized object in SWIG, (continued)
- Re: [Chicken-users] non-finalized object in SWIG, John Lenz, 2006/06/06
- Re: [Chicken-users] non-finalized object in SWIG, Daishi Kato, 2006/06/06
- Re: [Chicken-users] non-finalized object in SWIG, John Lenz, 2006/06/20
- Re: [Chicken-users] non-finalized object in SWIG, Daishi Kato, 2006/06/21
- Re: [Chicken-users] non-finalized object in SWIG, John Lenz, 2006/06/22
- Re: [Chicken-users] non-finalized object in SWIG, felix winkelmann, 2006/06/22
- Re: [Chicken-users] non-finalized object in SWIG, Daishi Kato, 2006/06/22
- about DISOWN (Re: [Chicken-users] non-finalized object in SWIG, Daishi Kato, 2006/06/26
- Re: about DISOWN (Re: [Chicken-users] non-finalized object in SWIG, John Lenz, 2006/06/30
- Re: about DISOWN (Re: [Chicken-users] non-finalized object in SWIG, Daishi Kato, 2006/06/30
- Re: about DISOWN (Re: [Chicken-users] non-finalized object in SWIG,
John Lenz <=