R6002 "floating point not loaded" in Managed C++ DLL that links with LIBCMTD.LIB

W

Whitney Kew

Hello everyone,

I'm developing a mixed-mode Managed C++ DLL using .NET 2003, and to
avoid the potential mixed-DLL-loading-deadlock issue discussed in MS
KB article 814472 (http://support.microsoft.com/?id=814472), I've
followed the steps in that article appropriately. However, our
application will have to support multiple versions of the Win OS, and
we don't want to run into possible DLL Hell problems with the C
Runtime DLLs. So, it's been decided that we need to link with the
static version of the CRT, LIBCMT(D).LIB, instead of MSVCRT(D).LIB.

Unfortunately, now that we're linking with LIBCMTD.LIB, I'm now
getting a Runtime Error, R6002, "floating point not loaded" when I try
to insert a float into a std::blush:stringstream inside my managed code.
My code is the following:

float fp = 1.23f;
std::blush:stringstream os;
os << fp; // CRASH here

Stepping into the std::blush:stringstream innards, the crash occurs at a
::sprintf() call inside the system file "xlocnum" inside a method
called num_put<>::do_put(). I've done some searching around and tried
playing with a _fltused variable, _fpreset(), _fpmath(), all to no
avail.

Could someone help me out with this? Thanks very much in advance!!

Whitney Kew
Software Engineer
Rain Bird Corporation
http://www.rainbird.com
 
D

DotNetJunkies User

I had a similar problem with a MS C++ (Ver 6) Win32 DLL which handles printout.
I realised that nowhere in the DLL is any floating point arith carried out, its all string handling but does use vsprintf
I forced it by making the dll entry point use floating point
eg:
BOOL APIENTRY DllMain(
HANDLE hMod,DWORD call_reason,LPVOID lpReserved)
{ double val;
val=17.5;
return TRUE;
}
Hope this helps
Roger Welby
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top