The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Farabi on December 27, 2010, 06:48:43 AM

Title: Where is ftol2_sse?
Post by: Farabi on December 27, 2010, 06:48:43 AM
Anyone know where is ftol2_sse function?
Title: Re: Where is ftol2_sse?
Post by: qWord on December 27, 2010, 11:26:31 AM
sounds like an msvcrt-function. However, you could also do it like:
movss xmm0,FP4(1.0)
cvtss2si eax,xmm0 ; SSE

; or
movsd xmm0,FP8(1.0)
cvtsd2si eax,xmm0 ; SSE2


qWord
Title: Re: Where is ftol2_sse?
Post by: Farabi on December 27, 2010, 01:40:57 PM
Quote from: qWord on December 27, 2010, 11:26:31 AM
sounds like an msvcrt-function. However, you could also do it like:
movss xmm0,FP4(1.0)
cvtss2si eax,xmm0 ; SSE

; or
movsd xmm0,FP8(1.0)
cvtsd2si eax,xmm0 ; SSE2


qWord

No, I need the dll. The .lib is linked to that function and I cant patch it.
Title: Re: Where is ftol2_sse?
Post by: dedndave on December 27, 2010, 02:03:15 PM
it may be included in a newer C compiler or VS package, Onan
another place you might look is a newer directX SDK
Title: Re: Where is ftol2_sse?
Post by: Farabi on December 28, 2010, 06:51:22 AM
Quote from: dedndave on December 27, 2010, 02:03:15 PM
it may be included in a newer C compiler or VS package, Onan
another place you might look is a newer directX SDK

I'll try it.
Title: Re: Where is ftol2_sse?
Post by: GregL on December 28, 2010, 07:44:49 PM
Farabi,

ftol2_sse is an internal C function that is called when a cast or conversion is made from a floating point variable to an integer. It was first used in VC 2005 (8.0).  Before that it was ftol_sse and before that ftol.



Title: Re: Where is ftol2_sse?
Post by: Farabi on December 30, 2010, 02:26:43 AM
what is this mean?

Quote
manifestdependency:type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'"; ignored
Title: Re: Where is ftol2_sse?
Post by: Antariy on December 30, 2010, 02:39:18 AM
Quote from: Farabi on December 27, 2010, 06:48:43 AM
Anyone know where is ftol2_sse function?

It is in static RTL of modern MSVCs.
Title: Re: Where is ftol2_sse?
Post by: GregL on December 31, 2010, 01:59:46 AM
Quote from: farabiwhat is this mean?

Quote
manifestdependency:type='win32' name='Microsoft.VC80.CRT' version='8.0.50608.0' processorArchitecture='x86' publicKeyToken='1fc8b3b9a1e18e3b'"; ignored

That is part of a manifest for the VC++ 2005 (8.0) C Run-Time (CRT) Library. The manifest must be embedded in the executable or included as a separate file to use the library.



Title: Re: Where is ftol2_sse?
Post by: dedndave on December 31, 2010, 03:24:33 AM
i'd like to know the context of that string
it looks like it is in source
where did you see that message, Onan ?
Title: Re: Where is ftol2_sse?
Post by: Farabi on December 31, 2010, 02:31:49 PM
Quote from: dedndave on December 31, 2010, 03:24:33 AM
i'd like to know the context of that string
it looks like it is in source
where did you see that message, Onan ?

I saw that message on RadAsm, when I compiled my executable.
Title: Re: Where is ftol2_sse?
Post by: dedndave on December 31, 2010, 02:39:44 PM
well - i don't understand how it can be ignored - lol
if your program requires that minimum version, then you might want a manifest file
there are some great examples by Edgar, Hutch, and others floating around
forum search tool  :U
Title: Re: Where is ftol2_sse?
Post by: Farabi on December 31, 2010, 02:44:12 PM
Okay thanks.
Title: Re: Where is ftol2_sse?
Post by: GregL on January 01, 2011, 04:10:55 AM
Farabi,

Are you linking to MSVCR80.DLL?
Title: Re: Where is ftol2_sse?
Post by: Farabi on January 01, 2011, 05:15:14 AM
Quote from: GregL on January 01, 2011, 04:10:55 AM
Farabi,

Are you linking to MSVCR80.DLL?


I dont know. I tried to use agar library, it is a OpenGL UI library, and it need that dll.
Title: Re: Where is ftol2_sse?
Post by: jj2007 on June 03, 2011, 10:10:00 PM
Hi Farabi,
Did you ever find a solution?
Jochen
Title: Re: Where is ftol2_sse?
Post by: qWord on June 03, 2011, 11:34:57 PM
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
Title: Re: Where is ftol2_sse?
Post by: jj2007 on June 03, 2011, 11:49:21 PM
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
Title: Re: Where is ftol2_sse?
Post by: qWord on June 04, 2011, 12:14:29 AM
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)