SWIG and __int64

Matt Whelan google at mattwhelan.info
Fri Aug 15 16:40:45 EDT 2003


Lyle Johnson <lyle at users.sourceforge.net> wrote in message news:<3F3BE519.3060802 at users.sourceforge.net>...
> Just to clarify: are you getting errors when running SWIG (i.e. to 
> generate the wrapper code) or when compiling the code that SWIG 
> generated for you?

Yes, it's in the SWIG generation step.

I think I've figured out the problem, but I still don't know what to
do about it.

All the __int?? types are specified as unsigned in my code.  SWIG
works great on default-signedness types, but it throws syntax errors
on "unsigned __int64" and friends.

So here's what I've got:

----Begin Code----
test.i:
%module test_wrap
%{
#include "test.h"
%}

%apply long long { __int64 }

%include test.h

test.h:
#ifndef TEST_H
#define TEST_H

unsigned __int64 foo();   //body is {return 42;} in test.cpp

#endif
----End Code----

If I remove the unsigned qualifier, it works fine, but as it is I get
a syntax error on line 4 of test.h.

I've tried adding the unsigned qualifier to the %apply statment in all
possible ways; none of them help.

I'm beginning to suspect this is a bug in SWIG.  If someone can give
me a work around (or educate me on what I'm doing wrong), I would
appreciate it.




More information about the Python-list mailing list