help python swig problem

ajikoe at gmail.com ajikoe at gmail.com
Wed Nov 30 18:58:51 EST 2005


Hi,

I tried to follow the example in swig homepage.
I found error which I don't understand.
I use bcc32, I already include directory where my python.h exist in
bcc32.cfg.

 /* File : example.c */

 #include <time.h>
 double My_variable = 3.0;

 int fact(int n) {
     if (n <= 1) return 1;
     else return n*fact(n-1);
 }

 int my_mod(int x, int y) {
     return (x%y);
 }

 char *get_time()
 {
     time_t ltime;
     time(&ltime);
     return ctime(&ltime);
 }

-------------------------
 /* example.i */
 %module example
 %{
 /* Put header files here or function declarations like below */
 extern double My_variable;
 extern int fact(int n);
 extern int my_mod(int x, int y);
 extern char *get_time();
 %}

 extern double My_variable;
 extern int fact(int n);
 extern int my_mod(int x, int y);
 extern char *get_time();

------------------------------------------------------------
I write this in my dos console:
swig -python example.i # this is ok
bcc32 -c example.c example_wrap.c # this has error
I found this error:
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
example.c:
example_wrap.c:
Warning W8004 example_wrap.c 428: 'uu' is assigned a value that is
never used in function SWIG_UnpackData
Warning W8004 example_wrap.c 669: 'flags' is assigned a value that is
never used in function PySwigObject_print
Error E2063 example_wrap.c 791: Illegal initialization in function
PySwigObject_type
Warning W8057 example_wrap.c 1660: Parameter 'self' is never used in
function _wrap_fact
Warning W8057 example_wrap.c 1688: Parameter 'self' is never used in
function _wrap_my_mod
Warning W8065 example_wrap.c 1696: Call to function 'get_time' with no
prototype in function _wrap_get_time
Warning W8057 example_wrap.c 1702: Parameter 'self' is never used in
function _wrap_get_time
Warning W8060 example_wrap.c 2106: Possibly incorrect assignment in
function SWIG_Python_FixMethods
*** 1 errors in Compile ***

How can I solve the problem.

Thanks in advance.

pujo




More information about the Python-list mailing list