SWIG and int main()

Ray Van Dolson rayvd at nospam.firetail.org
Wed Dec 6 03:03:05 EST 2000


jepler at inetnebr.com (Jeff Epler) wrote in
<slrn92i3tf.8tq.jepler at potty.housenet>: 

>I suspect that you may be calling Python's main(), rather than your
>main(). 
>
>potty% ARGV0=./hi python hi
>./hi: can't open file 'hi'
>
>... and then python calls the C exit() which will terminate without
>letting Python catch an error or anything.
>
>You will need to rename your main() function, perhaps using the C
>preprocessor to do the trick:
>     cc -Dmain=module_main test.c -o test.o
>will rename main to module_main .. just change the corresponding name in
>your swig .i file.
>
>Jeff

Thanks Jeff, this did indeed fix the problem!  Probably wouldn't have 
figured that one out on my own for a while. :)

Ray



More information about the Python-list mailing list