Hi all,
I’ve been building QuantLib & QuantLib SWIG “as is” with VS14 for use with C# and came across an initial error when running in debug, where visual studio breaks giving a PInvoke stack imbalance error, as described in this old thread:
https://sourceforge.net/p/quantlib/mailman/quantlib-users/thread/33276539.post%40talk.nabble.com/#msg28797382
I first tried the solution described in this thread (modifying the SWIG generated file to add calling convention = cdecl) and all seemed ok for a while.
The next problem appeared when QuantLib C++ was throwing an error, the C# wasn’t catching it and instead crashing with a memory imbalance error. Again, this is described in the thread below, but this time without a solution.
In order to catch the thrown C++ error, I’ve had to revert to the original SWIG generated C# source file, and instead build QuantLib C++ using the stdcall calling convention (default in VS14 proj files is cdecl).
Now everything is good, but I just wanted to ask around to other C# users if this is a problem they have had, if they solved it this way that I’m safe to assume I won’t find another issue of the kind down the line, or if I’m unnecessarily complicating things.
If this is indeed the best solution, would adding build configurations for stdcall be considered? Happy to provide the updated vcproj files if yes.
Regards,
Fabrice.
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users