I'm trying to "merge" an existing MSVC project with Lazarus by converting it to a DLL and then calling some of its entry points from the Lazarus App. Everything is OK until some FP operation used (in this case the _ftol2_pentium4() ) and the exception 0xC00002B5: Multiple floating point traps raises.
If it is msvc (that does not play nice with floats since IONS!, it is not IEEE compliant) and is 32 bits windows you simply -partially - disable floating point exceptions through Set8087CW if you access a msvc compiled dll.
I have an example, but not at hand.
See this discussion:
https://forum.lazarus.freepascal.org/index.php/topic,46014.msg326495.html#msg326495
*snip*Oops, sorry for not giving more details about.
If you are not compiling for 32 bit i386 Windows, I need a small example.
If you are, I will post that example.
That is correct, in so far that afaik there is an option to enable 8087() in x86_32-win64.
That sounds funny, is hidden, but Florian did that. I forgot the option. Intel/AMD only.
Well, SetExceptionMask is the way to go then. Glad that I forgot that option I mentioned ;D
There's a good chance that this example from the wiki is sufficient:
uses Math; //... begin SetExceptionMask(GetExceptionMask + [exOverflow,exZeroDivide,exInvalidOp]);
*snip*Does anybody have opinion on that?
What about compiling the DLL with TDM-GCC32 for example? Will it be better?
Does anybody have opinion on that?Well, Both GNU compilers and the Borland/Embarcadero compilers adhere to the IEEE standards for floating point handling and MSVC does not...