Adding functions to QuantLib SWIG

Posted by Zhi Xuan Fang on
URL: http://quantlib.414.s1.nabble.com/Adding-functions-to-QuantLib-SWIG-tp6140.html

Hi,

I am currently working on QuantLib SWIG 1.0 with SWIG version 1.3.29. I am having troubles adding functions to a class. For example adding the function int addlfunc(){ return 1;} to class Quote. From the marketelements.i file, I tried 

%{
using QuantLib::Quote;
%}

%ignore Quote;
class Quote {
  public:
    Real value() const;
    %extend{
      int addlfunc(){
return 1;
      }
    }
};

however it doesn't build. I am new to SWIG but when I was looking at their documentation, %extend seems to be the answer. 

In addition, does quantlib swig not allow reference to vectors as a function argument? I am trying to open up marketmodels to QuantLib SWIG. the nextStep function of BrownianGenerators takes in a reference to vectors as a function argument and I am unable to get it working like the other simpler functions of numberOfSteps, numberOfFactors, etc. 

Thanks for any help provided.

Regards,
Zhi Xuan

------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users