TypeError: type 'void *'

Hi all,

to explain the problem - Python and C++ sample code:

···

---
sample.py:

import gmodule

mapwindow = wx.Window(...)

gmodule.gClass(mapwindow)

---
gmodule.cpp

gClass(void *window)
{
    win = (wxWindow *) window;
}

This works on GNU/Linux, Mac OS X but fails on MS Windows:

  File "C:\OSGeo4W\apps\grass\grass-6.4.0RC3\etc\wxpython\gui_modules\vdigit.py"
, line 223, in __init__
    mapwindow)
  File "C:/OSGeo4W/apps/grass/grass-6.4.0RC3\etc\wxpython\vdigit\grass6_wxvdigit
.py", line 327, in __init__
    this = _grass6_wxvdigit.new_Digit(*args)

Any ideas how to fix it? Thanks in advance.

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

Hi,

···

2009/2/5 Martin Landa <landa.martin@gmail.com>:

sorry I forgot to include the most important part of traceback
message, here it is

    this = _grass6_wxvdigit.new_Digit(*args)
TypeError: in method 'new_Digit', argument 2 of type 'void *'

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

Hi,

···

2009/2/5 Martin Landa <landa.martin@gmail.com>:

sorry I forgot to include the most important part of traceback
message, here it is

    this = _grass6_wxvdigit.new_Digit(*args)
TypeError: in method 'new_Digit', argument 2 of type 'void *'

Martin

--
Martin Landa <landa.martin gmail.com> * http://gama.fsv.cvut.cz/~landa

Martin Landa wrote:

Hi all,

to explain the problem - Python and C++ sample code:

---
sample.py:

import gmodule

mapwindow = wx.Window(...)

gmodule.gClass(mapwindow)

---
gmodule.cpp

gClass(void *window)
{
    win = (wxWindow *) window;
}

This works on GNU/Linux, Mac OS X but fails on MS Windows:

  File "C:\OSGeo4W\apps\grass\grass-6.4.0RC3\etc\wxpython\gui_modules\vdigit.py"
, line 223, in __init__
    mapwindow)
  File "C:/OSGeo4W/apps/grass/grass-6.4.0RC3\etc\wxpython\vdigit\grass6_wxvdigit
.py", line 327, in __init__
    this = _grass6_wxvdigit.new_Digit(*args)
TypeError: in method 'new_Digit', argument 2 of type 'void *'

Any ideas how to fix it? Thanks in advance.

In SWIG wrapped code the void* is just like any other pointer type, it is *not* a magical anything and everything type of value like it is in C/C++. Why don't you just use a wxWindow* in gClass's parameter list? You'll need to do a few other things to make the two modules blend together well (specifically so the SWIG typeinfo will be shared between them) but you'll end up with type-safety and more intelligent modules.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Hi,

[...]

"C:/OSGeo4W/apps/grass/grass-6.4.0RC3\etc\wxpython\vdigit\grass6_wxvdigit
.py", line 327, in __init__
   this = _grass6_wxvdigit.new_Digit(*args)
TypeError: in method 'new_Digit', argument 2 of type 'void *'

Any ideas how to fix it? Thanks in advance.

In SWIG wrapped code the void* is just like any other pointer type, it is
*not* a magical anything and everything type of value like it is in C/C++.
Why don't you just use a wxWindow* in gClass's parameter list? You'll need
to do a few other things to make the two modules blend together well
(specifically so the SWIG typeinfo will be shared between them) but you'll
end up with type-safety and more intelligent modules.

thanks, I'll take a look at your suggestions.
  
Martin

···

2009/2/7 Robin Dunn <robin@alldunn.com>: