Re: MSVC CRT Issue: Unresolved symbols
From: Michael Maier (michael.maier1_at_rwth-aachen.de)
Date: Wed, 01 Sep 2004 21:01:08 +0200
thanks so far. Ic, so there's no way to write a cross-compiler solution
(without compiler-specific code). Currently it works fine with using
these symbols by adding one matching crt lib. So there's no .CRT section
nor some other non-required code elements, as it should ^___^
James Brown wrote:
> there is nothing you can do to avoid the need for including
> functions that the compiler has deemed necessary to use - seeing as
> you have located the CRT source-code, you can take the required functions
> from that and include them in your own CRT version.
> "Michael Maier" <firstname.lastname@example.org> wrote in message
>>Thanks for the /Zl compiler option.
>>But I need floating point and large integer operations. Instead of writing
>>int n = (int)fp_nb; using an own assembly function so the _ftol2 function
>>is not used wouldn't be any problem.
>>The _fltused seems a global extern variable, searching the CRT code I
>>found a comment containing "If floating-point is linked in (_fltused)
>>[...]". The problem is now, how to change the code so these symbols are
>>not required any more; e.g. the _fltused variable is required every time I
>>even declare something as floating point :-/
>>James Brown wrote:
>>>Define two entrypoint functions in separate C files:
>>>mainCRTStartup and WinMainCRTStartup
>>>Compile all your files with the "/Zl" compiler option.
>>>Don't use any features that require c-runtime to be linked in -
>>>i.e. if you use floating point / large integer, then the compiler will
>>>generate code to call functions inside the CRT to handle this stuff..
>>>"Michael Maier" <email@example.com> wrote in message
>>>>I am currently developing an own CRT-like runtime, and it should work
>>>>without any dependencies on some compiler specific functions.
>>>>Everything works fine, but: The MSVC compiler still adds some code so the
>>>>linker won't link with the /NODEFAULTLIB flag due to unresolved symbols.
>>>>I was able to remove some elements like the security check issue by
>>>>disabling some options for the compiler, but there are still some
>>>>functions left as listed below:
>>>>error LNK2001: Unresolved external symbol __fltused
>>>>error LNK2001: Unresolved external symbol __aulldvrm
>>>>error LNK2001: Unresolved external symbol __ftol2
>>>>error LNK2001: Unresolved external symbol __allmul
>>>>Does anyone know how to tell the MSVC Compiler not to include these
>>>>specific functionality; in other words not using any compiler CRT stuff?
>>>>In the options dialog of MSVS2003.NET there's no option like: "Runtime
>>>>Library: None" . I'd like a better solution than "emulating" these
>>>>functions by including own versions (which, of couse, would be fun for
>>>>different compiler version -.-).
>>>>As you see by the __ftol2 symbol, I'm using MSVC7.