News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Where is ftol2_sse?

Started by Farabi, December 27, 2010, 06:48:43 AM

Previous topic - Next topic

jj2007

Hi Farabi,
Did you ever find a solution?
Jochen

qWord

hi jj,
you can find this function in the static CRT library libcmt.lib.
This works in my system:
includelib "\Program Files (x86)\Microsoft Visual Studio 10.0\VC\lib\libcmt.lib"
...
_ftol2_sse proto c
...
invoke _ftol2_sse ; st(0) = real4
FPU in a trice: SmplMath
It's that simple!

jj2007

Hi qWord,

Schwarzenegger says "libcmt.lib(cpu_disp.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators" but otherwise this works perfectly, thanks.

So the trick is to declare it as _ftol2_sse proto c in Masm, in spite of the fact that the C compiler complains about it. Cute. I hat tried my luck with various includes and pragmas in the C source, but no success.

:U

qWord

Quote from: jj2007 on June 03, 2011, 11:49:21 PMwarning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
this cause the function to not use SSE2 - instead the fpu is used. The reason is that the CRT is not initialized (there is an global variable, that indicate the usage of sse2). To solve this you mus call CRT_INIT at program start:
Quote;return: bool
_CRT_INIT proto stdcall hInst:HINSTANCE,FdwReason:DWORD,LpReserved:DWORD
invoke _CRT_INIT,hInstance,DLL_PROCESS_ATTACH,0
(for clean up simply call the function with DLL_PROCESS_DETACH)
FPU in a trice: SmplMath
It's that simple!