Bugs item #3466468, was opened at 2011-12-28 04:03
Message generated for change (Tracker Item Submitted) made by You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3466468&group_id=12740 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: https://www.google.com/accounts () Assigned to: Nobody/Anonymous (nobody) Summary: SWIG/CSharp/VS2010 Initial Comment: Hello I have been using QuantLib in Visual Studio 2010, and have come across the following issues: 1) There is an %include in the SWIG wrapper which #defines SWIGSTDCALL to nothing if the SWIG target is CSharp. This causes P/Invoke to throw an exception under the .NET 4.0 Framework. (see http://msdn.microsoft.com/en-us/library/ee941656(v=VS.100).aspx, "Platform Invoke") because the wrapper functions are not __stdcall. 2) In order to use the numerical integration classes from C# I had to add the following code to the SWIG wrapper, perhaps you could consider integrating it into the next release: === types.i === ... #elif defined(SWIGCSHARP) // The following macro defines a typemap between boost::function<RTYPE(PTYPEA)> and a corresponding .NET delegate type %define %cs_func1(RTYPE, friendlyRTYPE, PTYPEA, friendlyPTYPEA) #define BFUNC boost::function<RTYPE(PTYPEA)> #define DELEGATE friendlyPTYPEA##To##friendlyRTYPE##Delegate %pragma(csharp) modulecode=%{ public delegate RTYPE friendlyPTYPEA##To##friendlyRTYPE##Delegate(PTYPEA a); %} %typemap(ctype) BFUNC, BFUNC& "void*" %typemap(in) BFUNC { $1 = (RTYPE (__stdcall *)(PTYPEA)) $input; } %typemap(in) BFUNC& { $1 = (RTYPE (__stdcall *)(PTYPEA)) $input; } %typemap(imtype, out="IntPtr", noblock=1) BFUNC, BFUNC& { NQuantLibc.DELEGATE } %typemap(cstype, out="IntPtr", noblock=1) BFUNC, BFUNC& { NQuantLibc.DELEGATE } %typemap(csin, noblock=1) BFUNC, BFUNC& { $csinput } #undef DELEGATE #undef BFUNC %enddef // Typemap boost::function<double(double)> to NQuantLibc.DoubleToDoubleDelegate %cs_func1(double, Double, double, Double) #endif ... === integrals.i === ... %define INTEGRATION_METHODS ... #elif defined(SWIGCSHARP) Real Call(boost::function<double(double)> f, Real a, Real b) { return (*self)(f, a, b); } #endif ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112740&aid=3466468&group_id=12740 ------------------------------------------------------------------------------ Ridiculously easy VDI. With Citrix VDI-in-a-Box, you don't need a complex infrastructure or vast IT resources to deliver seamless, secure access to virtual desktops. With this all-in-one solution, easily deploy virtual desktops for less than the cost of PCs and save 60% on VDI infrastructure costs. Try it free! http://p.sf.net/sfu/Citrix-VDIinabox _______________________________________________ QuantLib-dev mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/quantlib-dev |
Free forum by Nabble | Edit this page |