SWIG and __int64

Discussion in 'Python' started by Matt Whelan, Aug 14, 2003.

  1. Matt Whelan

    Matt Whelan Guest

    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
    Matt Whelan, Aug 14, 2003
    #1
    1. Advertising

  2. Matt Whelan

    Lyle Johnson Guest

    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?
    Lyle Johnson, Aug 14, 2003
    #2
    1. Advertising

  3. Matt Whelan

    Matt Whelan Guest

    Lyle Johnson <> wrote in message news:<>...
    > 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.
    Matt Whelan, Aug 15, 2003
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Tsiombikas (Nuclear / the Lab)

    Re: Different results if compared as double or __int64?

    John Tsiombikas (Nuclear / the Lab), Jun 30, 2003, in forum: C++
    Replies:
    1
    Views:
    424
    Victor Bazarov
    Jun 30, 2003
  2. Vivi
    Replies:
    2
    Views:
    5,988
    ES Kim
    Aug 25, 2003
  3. Tim Clacy

    __int64 vs. long long

    Tim Clacy, Nov 10, 2003, in forum: C++
    Replies:
    8
    Views:
    821
    Rolf Magnus
    Nov 10, 2003
  4. JR
    Replies:
    3
    Views:
    376
    Xenos
    Feb 5, 2004
  5. Jayesh

    format of double and __int64

    Jayesh, Nov 28, 2005, in forum: C Programming
    Replies:
    8
    Views:
    530
    Joe Wright
    Nov 29, 2005
Loading...

Share This Page