How to get VS2013 to stop generating calls to __dtol3, __dtoui3, and other functions for casting between integer types?

蓝咒 提交于 2019-12-18 13:22:30

问题


I am in the process of upgrading a Visual Studio 2010 project that targets the INtime RTOS. Code that performs casting operations fail to link. When investigating the "inline assembly" output files, it turns out that for some integer casting operations, VS2013 is generating assembly instructions to calls to __dtol3, __dtoui3, __dtoul3, __ltod3, and __ultod3. The problem is that the INtime libraries do not contain definitions for these functions. I've verified that VS2013 does the same for Win32 targets for both Debug and Release builds.

Is there a way to get VS2013 to stop generating generating calls to these functions?


回答1:


You would need to disable SSE2 codegen, through use of the /arch option (use either /arch:IA32 or /arch:SSE).

Alternatively...(what follows is not officially supported; your mileage may vary; do this at your own risk)

Extract from msvcrt.lib the object that defines these functions, and link that object directly into your program. These functions are defined in the object named ftol3.obj; you can extract it using the lib tool:

=>lib /nologo /list msvcrt.lib | findstr ftol3
f:\binaries\Intermediate\vctools\crt_bld\SELF_X86\crt\prebuild\INTEL\dll_lib\ftol3.obj

=>lib /nologo /extract:f:\binaries\Intermediate\vctools\crt_bld\SELF_X86\crt\prebuild\INTEL\dll_lib\ftol3.obj msvcrt.lib

You may need additional objects, depending on (a) which functions you use and (b) what, exactly, the INtime libraries define. Again, this is not a supported way to use the Visual C++ runtime libraries, and it may or may not work for your particular use case.




回答2:


possibly another way:

add compile option /d2noftol3

this option is undocumented




回答3:


Try create one of them __dtol3, __dtoui3, __dtoul3, __ltod3, and __ultod3, for ex.

extern "C" unsigned int _dtoui3(const double x) {
     return (unsigned int) _mm_cvttsd_si32 (_mm_set_sd(x));
}

Make function externally visible and implement in one file.

Some info



来源:https://stackoverflow.com/questions/19556103/how-to-get-vs2013-to-stop-generating-calls-to-dtol3-dtoui3-and-other-funct

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!