[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pygame] Help with C API
Hello again!
I've found a partial answer to my problem!
I was using C++ files. I mean that I asked SWIG to generate C++ files, in
this way I could use default parameters in the function definition (that
was inlined).
Switching to C file generation (and losing default parameters, sigh
) I was able to succesfully compile everything.
Anyway I don't think it is a good thing, what if I want to write some extension
using C++?
It seems to me that it will not be possible to use PyGame in that case? Or
is there some workaround?
(BTW, I'm using VC++ SP5). Maybe I'm just missing something obvious, after
all I'm not a C/C++ guru...
Another question:
I've read some time ago, that it would be possible to embed a pyGame/SDL
window in wxPython.
Well. I tried it but without success. Is there somebody that has got some
working demo?
Thanks,
Riccardo
P.S.
PyGame is really a fantastic library that I'm really enjoying. Hope that
I'll be soon able to show something.
Riccardo Trocca wrote:
Hello, I'm writing an extension module for python
2.2.1 on Win32.
I'm using SWIG to wrap my functions and PyGame 1.4.9.
The compiler is Visual C++ with the latest (hope) platform SDK installed.
What I need to do is converting from my own type (an image container) to
an SDL_Surface (in python).
When
using SWIG You must specify in the source file the needed includes for your
source file and an init part where you can call the init methods of external
modules.
In my case the two parts of the source look like:
%{
#include <stdio.h>
#include <ipl.h>
#include <Numeric\arrayobject.h>
#include <pygame\pygame.h>
#include <sdl.h>
%}
and
%init %{
import_array();
import_pygame_base();
import_pygame_surface();
%}
In the previous version of this program I just used numeric, and everything
worked fine. Now I'm trying to add SDL support.
when running my setup.py
I obtain the following:
...pygame.h(60): warning C4005: 'WIN32' : macro redefinition
E:\SDK\Microsof\Microsfot SDK\include\ole2.h(24): see previous definition
of 'win32'
BTW I wrote a first version of my lib where I forgot to put the 2 import_pygame
statements, and everything compiled well. Then I suddenly realized that
something wasw missing and I added the init lines. I obtained:
iplconversion.cpp(858): error C2440: 'initializing' : cannot convert from
'void *' to 'void **'. Conversion from 'void*' to pointer to non-'void'
requires an explicit cast.
iplconversion.cpp(859): error C2440: 'initializing' : cannot convert from
'void *' to 'void **'. Conversion from 'void*' to pointer to non-'void'
requires an explicit cast.
iplconversion.cpp(859): error C2440: 'initializing' : cannot convert from
'void *' to 'void **'. Conversion from 'void*' to pointer to non-'void'
requires an explicit cast.
iplconversion.cpp is the file generated by SWIG and at lines 858 and 859
(857) import_array();
(858) import_pygame_base();
(859) import_pygame_surface();
Well, I'm lost.
Any suggestions?
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org