From: Andrea <mar...@go...> - 2009-10-29 18:00:23
|
On 29/10/09 16:03, Luigi Ballabio wrote: > On Wed, 2009-10-21 at 17:58 +0100, Andrea wrote: >> On 21/10/09 15:55, Luigi Ballabio wrote: >>> unfortunately, polymorphism doesn't currently work across >> languages. >>> >> Indeed. >> I've tried to use directors and it seems to work well if there are no >> shared_ptr involved. >> >> My problem now is [...] I don't seem to be able to create a shared_ptr >> in the target language. > > There would be quite a bit of work to do. You would have to: > - add a constructor to boost::shared_ptr in common.i so that it takes a > pointer; I've got a big doubt here. Is it safe to stick the raw pointer into a shared_ptr? Is it already owned by some other swig mechanism? > - modify the exported payoff classes so that they no longer hide the > shared_ptr (e.g., export the actual PlainVanillaPayoff, not > PlainVanillaPayoffPtr) and enable directors; > - export the shared_ptr<Payoff> as a separate class; > - fix the other interfaces so that they work with the new classes. > > Let me know if you get stuck in any of the steps. > > Luigi > > |