Hi,
Compiling the following code in MSVC6 gives the linker error 'unresolved
external symbol __ftol'..
// -- Code begin --
#pragma comment(linker, "/entry:Main")
#pragma comment(linker, "/nodefaultlib")
#pragma comment(linker, "/opt:nowin98")
long ftol(double const f)
{ int n;
__asm fld f
__asm fistp n
if(f - n < 0) n--;
return n;
}
extern "C" int const _fltused = 1;
int __stdcall Main(void)
{ double x = 1.0f;
return (int)x; // This line causes the linker error
}
// -- Code end --
..I was wondering if it is possible to make my ftol be the one used
automatically by MSVC6 (so I don't have to do { return ftol(x); } ). The
closest I've come to getting this to work is by adding the following after
the { extern "C" .. _fltused = 1 } line, which stops the linker complaining,
but still doesn't work as the program crashes..
extern "C" long (*_ftol)(double const) = ftol;
..
Thank you for any help,
Kind regards,
Eliott