(no subject)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

(no subject)

Sakti Swarup-OP
        I have dowloaded Swig1.3.3NT and Python 2.0 for windows. I tried an
example given in "Examples Directory", I could compile example.i for swig to
generate example_wrap.c
compiled example.c
but when compiling example_wrap.c along with example.c it generates lots of
errors.
Apparently these are because the Header file "Python.h" doesn't contains
some items like
"PyObject". I would like to know info on this.

Yours Sincerely,
Sakti


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: (no subject)

Ferdinando Ametrano-6
>         I have dowloaded Swig1.3.3NT and Python 2.0 for windows.
If you're trying to use the release 0.1.1 you don't need to use Swig, since
the wrapper files are already included and ready to be compiled.
This should also be true if you're trying to compile the latest CVS
snapshot: anyway in this case it may happen that wrapper files are out of
synch.

Of course if you want to actively develop QuantLib using Python (or
scripting languages) it is useful to have Swig.
In this case please note that we're using 1.3a5. Since the NT port is not
available yet you have to use CygWin.
Follow these steps:

a) Download Cygwin from http://cygwin.com/ and install it. Take note of
your CygWin root (C:\cygwin from now on)
b) Download SWIG1.3a5 from
http://download.sourceforge.net/swig/swig1.3a5.tar.gz
c) Copy the file swig1.3a5.tar.gz in a directory under the control of
Cygwin (e.g. your home dir C:\cygwin\home\username)
d) Open a Cygwin shell
         > cd "the directory where swig1.3a5.tar.gz is"
         > gunzip swig1.3a5.tar.gz
         > tar xvf swig1.3a5.tar
         > cd SWIG1.3a5
         > ./configure
        edit "./Makefile" and replace "SWIG_LIB = $(prefix)/lib/swig1.3"
               with "SWIG_LIB = $(prefix)/lib/swig1.3a5"
        edit "./Source/Include/swigconfig.h" and replace
                 #define SWIG_LIB   "/usr/local/lib/swig1.3"
           with  #define SWIG_LIB   "/usr/local/lib/swig1.3a5"
         > make
         > make install
         > mv /usr/local/bin/swig.exe /usr/local/bin/swig1.3a5.exe
e) Include "C:\cygwin\usr\local\bin" and the path where you have the
cygwin1.dll file ("C:\cygwin\bin") in your system variable $PATH

now you're ready to compile QuantLib.

Borland compiler: use the makefile provided (you will have to change a
couple of defines accordingly to your Python installation).
MSVC compiler: use QuantLib\Win\PyWrap.bat to generate the wrappers. You
will have to add the directory of Python.h to your MSVC settings

>  I tried an
>example given in "Examples Directory", I could compile example.i for swig to
>generate example_wrap.c
>compiled example.c
>but when compiling example_wrap.c along with example.c it generates lots of
>errors.
>Apparently these are because the Header file "Python.h" doesn't contains
>some items like
>"PyObject". I would like to know info on this.
This is a problem related with your Swig installation. See my suggestion
for Borland and MSVC

We have changed a few things to have an easier Windows installation. They
will be available this week with release 0.1.2
I will also add a FAQ entry for CygWin/Swig

ciao -- Nando



Loading...