MSVCRT Runtime Error

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

MSVCRT Runtime Error

Lucas Ingles
Hello,

I am trying to build a simple DLL for Excel that uses QuantLib with MinGW on Windows 7. The DLL exports simple C functions using the following statements:
extern "C" __declspec(dllexport) __stdcall double some_function().
QuantLib objects are used inside these functions. I was able to use some objects with success until I tried template classes, like InterpolatedZeroCurve<Interpolator>. The code build successfully, but when I ran it in Excel I get the following error:
"Microsoft Visual C++ Runtime Library: This application has requested the Runtime to terminate it in an unusual way. Please contact the applications support team for more information".
The same function works if I test it through a simple command line application. Also, I verified dependencies with Dependency Walker and everything is fine.
I would appreciate very much any help or explanation regarding this behaviour.

Thanks very much,
--
Lucas Lorenzi Ingles

------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: MSVCRT Runtime Error

Lucas Ingles

I forgot to mention that I am accessing the DLL via VBA using the "Declare" statement.

Thanks very much,
Lucas

Em 24/08/2015 23:32, "Lucas Ingles" <[hidden email]> escreveu:
Hello,

I am trying to build a simple DLL for Excel that uses QuantLib with MinGW on Windows 7. The DLL exports simple C functions using the following statements:
extern "C" __declspec(dllexport) __stdcall double some_function().
QuantLib objects are used inside these functions. I was able to use some objects with success until I tried template classes, like InterpolatedZeroCurve<Interpolator>. The code build successfully, but when I ran it in Excel I get the following error:
"Microsoft Visual C++ Runtime Library: This application has requested the Runtime to terminate it in an unusual way. Please contact the applications support team for more information".
The same function works if I test it through a simple command line application. Also, I verified dependencies with Dependency Walker and everything is fine.
I would appreciate very much any help or explanation regarding this behaviour.

Thanks very much,
--
Lucas Lorenzi Ingles

------------------------------------------------------------------------------

_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: MSVCRT Runtime Error

Eric Ehlers-3
Hello,

What does the function look like?  When it crashes under Excel, are you
sure the inputs are the same as the successful execution outside of
Excel?  Have you tried debugging it?

Kind Regards,
Eric

On Tue, 25 Aug 2015 07:47:42 -0300
Lucas Ingles <[hidden email]> wrote:

> I forgot to mention that I am accessing the DLL via VBA using the
> "Declare" statement.
>
> Thanks very much,
> Lucas
> Em 24/08/2015 23:32, "Lucas Ingles" <[hidden email]>
> escreveu:
>
> > Hello,
> >
> > I am trying to build a simple DLL for Excel that uses QuantLib with
> > MinGW on Windows 7. The DLL exports simple C functions using the
> > following statements:
> > extern "C" __declspec(dllexport) __stdcall double some_function().
> > QuantLib objects are used inside these functions. I was able to use
> > some objects with success until I tried template classes, like
> > InterpolatedZeroCurve<Interpolator>. The code build successfully,
> > but when I ran it in Excel I get the following error:
> > "Microsoft Visual C++ Runtime Library: This application has
> > requested the Runtime to terminate it in an unusual way. Please
> > contact the applications support team for more information".
> > The same function works if I test it through a simple command line
> > application. Also, I verified dependencies with Dependency Walker
> > and everything is fine.
> > I would appreciate very much any help or explanation regarding this
> > behaviour.
> >
> > Thanks very much,
> > --
> > Lucas Lorenzi Ingles
> >
>

------------------------------------------------------------------------------
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: MSVCRT Runtime Error

Lucas Ingles
Eric, sorry for the late response.

Thanks very much for the ideas. In fact, the inputs of the successful execution outside Excel (simple fake data), were different from the Excel inputs (real market curves).
I thought the problem was using template classes, but after comparing the two inputs, I realized: InterpolatedZeroCurve<Interpolator> fails when we construct it with consecutive points (in actual days, i.e. consecutive days).
I can initialize the object with some consecutive points, but when ALL points are consecutive the class breaks. I will try to study the objects to understand this behaviour and if I succeed I will post here the reason.
More information: I am initializing the object using the simple dates and yields vector, without using the "jumps" vector. Also, I will try to post an example here in the next days.

Again, thanks very much for the help,
Lucas

2015-08-25 9:43 GMT-03:00 Eric Ehlers <[hidden email]>:
Hello,

What does the function look like?  When it crashes under Excel, are you
sure the inputs are the same as the successful execution outside of
Excel?  Have you tried debugging it?

Kind Regards,
Eric

On Tue, 25 Aug 2015 07:47:42 -0300
Lucas Ingles <[hidden email]> wrote:

> I forgot to mention that I am accessing the DLL via VBA using the
> "Declare" statement.
>
> Thanks very much,
> Lucas
> Em 24/08/2015 23:32, "Lucas Ingles" <[hidden email]>
> escreveu:
>
> > Hello,
> >
> > I am trying to build a simple DLL for Excel that uses QuantLib with
> > MinGW on Windows 7. The DLL exports simple C functions using the
> > following statements:
> > extern "C" __declspec(dllexport) __stdcall double some_function().
> > QuantLib objects are used inside these functions. I was able to use
> > some objects with success until I tried template classes, like
> > InterpolatedZeroCurve<Interpolator>. The code build successfully,
> > but when I ran it in Excel I get the following error:
> > "Microsoft Visual C++ Runtime Library: This application has
> > requested the Runtime to terminate it in an unusual way. Please
> > contact the applications support team for more information".
> > The same function works if I test it through a simple command line
> > application. Also, I verified dependencies with Dependency Walker
> > and everything is fine.
> > I would appreciate very much any help or explanation regarding this
> > behaviour.
> >
> > Thanks very much,
> > --
> > Lucas Lorenzi Ingles
> >
>



--
Lucas Lorenzi Ingles

------------------------------------------------------------------------------

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