Login  Register

Re: SWIG interface files

Posted by Ferdinando M. Ametrano-2 on Jun 05, 2002; 5:34am
URL: http://quantlib.414.s1.nabble.com/SWIG-interface-files-tp10103p10104.html

Hi Andre

Luigi is the master of SWIG, but here's a few suggestions while we wait for
his answer

>I have a cpp class in a library of my own that inherits off
>QuantLib::Instrument. I now need to create a SWIG file for this.
>I assumed that I would only need to "%import Instruments.i" to get the
>needed definitions, this leads to all kinds of compile errors.
>Using "%include Instruments.i" doesn't hack it either,
I would "%include ql.i", this will include all the QuantLib interfaces and
this is probably what you want, since you will want your module to include
the whole QuantLib module to use all the QuantLib feautures.

>but I get weird errors when using my library: accessing
>DayCounter.yearFraction(d1,d2) for instance gives me an error saying it
>needs 5 arguments (only 3 supplied) - it's as if it doesn't know the last 2
>are default arguments.
see the file QuantLib-Python\QuantLib\defaults.py for the specification of
default values. Your module will need that file.

Hope this helps

ciao -- Nando

PS Luigi, when we'll settle on the new forthcoming version of SWIG with all
languages consolidated into a single QuantLib-SWIG module, do you plan to
provide an example on how to setup a project based on QuantLib-SWIG?
It would be similar in spirit to our C++ Examples based on QuantLib.