[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] Help with C API



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