[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Python SWIG for Win32

From: Branko Čibej <brane_at_xbc.nu>
Date: 2003-02-14 00:28:45 CET

Dale Hirt wrote:

>Hello all,
>
>I have been hacking on the Python bindings, and it's been a bit of a beyatch
>to say the least. However, I am starting to get there. I am simply stuck
>on one portion of it.
>
>Here's the error message:
>
>swigging d:\work\svn_work\subversion\bindings\swig/svn_repos.i to
>build\svn_repos.c
>svn_repos.c
>build\svn_repos.c(1677) : error C2632: 'long' followed by 'long' is illegal
>D:\Programs\SWIG-1.3.17\swig.exe -c -python -noproxy
>-Id:\work\svn_work\subversion\bindings\swig
>-Id:\work\subversion\subversion\include -IC:\Apache\Apache2\include
>-ID:\Programs\ActiveState\Python\2.2.2b224\include -o build\svn_repos.c
>d:\work\svn_work\subversion\bindings\swig/svn_repos.i
>C:\Program Files\Microsoft Visual Studio\VC98\BIN\cl.exe /c /nologo /Ox /MD
>/W3 /GX -Id:\work\svn_work\subversion\bindings\swig
>-Id:\work\subversion\subversion\include -IC:\Apache\Apache2\include
>-ID:\Programs\ActiveState\Python\2.2.2b224\include /Tcbuild\svn_repos.c
>/Fobuild\temp.win32-2.2\Release\svn_repos.obj /D APR_STATIC /D WIN32 /D
>APU_STATIC /D __WIN32__
>error: command '"C:\Program Files\Microsoft Visual Studio\VC98\BIN\cl.exe"'
>failed with exit status 2
>
>I tracked it down to these lines in svn_repos.c:
>
>static PyObject *_wrap_svn_repos_dated_revision(PyObject *self, PyObject
>*args) {
>...
> apr_time_t arg3 ;
>....
>-> arg3 = (long long) PyLong_AsLongLong(obj1);
>
Oh blast, this is wrong...

>...
>}
>
>So then I tracked it down to these lines in apr.i:
>
>/* -----------------------------------------------------------------------
> handle the mappings for apr_time_t
>
> Note: we don't generalize this to 'long long' since SWIG is starting
> to handle that.
>*/
>
>%apply long long { apr_time_t };
>
And so is this. Nuts, nuts, nuts. Nobody shoudl use "long long" directly
-- instead, we should use

    LONG_LONG

as that's always guaranteed to be 64 bits, while "long long" could
easily be 128 bits on some architectures (not to mention that it's not
portable to non-C99 compilers).

-- 
Brane Čibej   <brane_at_xbc.nu>   http://www.xbc.nu/brane/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Feb 14 00:29:25 2003

This is an archived mail posted to the Subversion Dev mailing list.