473,466 Members | 1,565 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

SWIG and __int64

Supposedly, recent versions of SWIG can be made to work with MS VC++'s
non-standard integer data types. According to a recent SWIG ChangeLog
entry:

%apply long long { __int64 };

should make Swig happy. But it doesn't. I get Syntax Errors on each
line where __int64 appears.

Am I missing something? I'm new to SWIG (but not to Python or C++).
My searches to date have turned up no examples of successful __int64
and SWIG interaction. If anyone could provide such an example, it
would be deeply appreciated.

I also need to do similar things for __int8 * and __int32, but I
assume once I get __int64 working the solutions for those will become
obvious.

--
Matt Whelan
Jul 18 '05 #1
2 4759
Matt Whelan wrote:
Supposedly, recent versions of SWIG can be made to work with MS VC++'s
non-standard integer data types. According to a recent SWIG ChangeLog
entry:

%apply long long { __int64 };

should make Swig happy. But it doesn't. I get Syntax Errors on each
line where __int64 appears.


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?

Jul 18 '05 #2
Lyle Johnson <ly**@users.sourceforge.net> wrote in message news:<3F**************@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.
Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ernie | last post by:
Hi, I am learning swig to use C codes from Python. Here is the swig file mvf.i: %module mvf %include "carrays.i" %array_class(double, doubleArray); %typemap(out) double, float "$result =...
3
by: Kevin Dahlhausen | last post by:
Could anyone post a simple setup.py script that uses a SWIG interface to C++ code and the mingw compiler? I followed some online samples, and am using the setup.cfg file to specify swig-c++=1....
1
by: Java and Swing | last post by:
I am trying to wrap some C code I have. Currently I have something like... defs.h ----------- typedef unsigned long MY_DIGIT; myapp.c ------------- void MakeDigits(MY_DIGIT digits) {
1
by: Jesse Hose | last post by:
I get odd behavior in the debugger with the following code. The output of the program itself is correct, but when I add the g_bad_int64_max and g_bad_int64_min to the watch window they show values...
2
by: ajikoe | last post by:
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...
8
by: hurry | last post by:
hi, I am writing a c program in VC++ 6. I have 2 files with 3 functions. file-1 having two functions "a" and "c" file-2 having a single function "b" with function "a" as main() , "a"...
4
by: Kio | last post by:
Hi, For example: 1 __int64 fib4(__int64 n) 2 { 3 if ((n==1) || (n==2)) return 1; 4 else return (fib(n-1)+fib(n-2)); 5 }
21
by: Angus | last post by:
I need to convert a double to a 64 bit integer. I am using __int64 but could of course use a more portable type. To perform the correct casts: double d = 3.3; __int64 i64; i64 =...
29
by: Kenzogio | last post by:
Hi, I have a struct "allmsg" and him member : unsigned char card_number; //16 allmsg.card_number
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.