Re: link with C runtime library

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Thanks Alex,


1.

Look in project's settings: C/C++ -> Code Generation -> Runtime
Library. Alternatively, look at resulting command line. There will
be one of /Mxxx switches.

I am using Visual Studio 2008. I have checked C/C++ -> Code Generation ->
Runtime Library /MT, /MTd, /MD and /MDd. Any differences between them?

2.

Because C++ relies on CRT in many ways. This is not only legacy
functions. C++ compiler generates a lot of code that assumes the
presence of CRT. Compiler and CRT are tightly coupled. You brought
the relevant citation from MSDN by yourself: CRT calls objects'
destructors and constructors, participates in implementation of
C++ exceptions mechanism etc.

ok. I have got your idea. We can not separate C and C++ libraries and they
are mixed together.


regards,
George

"Alex Blekhman" wrote:

"George" wrote:
1. How could I know if a project whether DLL or EXE or static
lib is linked
with C Runtime library?

Look in project's settings: C/C++ -> Code Generation -> Runtime
Library. Alternatively, look at resulting command line. There will
be one of /Mxxx switches.

2. Why we need C Runtime library in a C++ project? We need to
call some
legacy C functions like printf other than pure C++ functions
std::cout?

Because C++ relies on CRT in many ways. This is not only legacy
functions. C++ compiler generates a lot of code that assumes the
presence of CRT. Compiler and CRT are tightly coupled. You brought
the relevant citation from MSDN by yourself: CRT calls objects'
destructors and constructors, participates in implementation of
C++ exceptions mechanism etc.

3. If we use default entry point in DLL (DllMain), does it mean
C Runtime
Library is dynamically linked?

No, it doesn't mean anything. You need specify explicitly in
project's settings what flavor of CRT you want to use.

HTH
Alex



.



Relevant Pages

  • Re: why CRT has to written in C
    ... The nature of the CRT does vary a bit. ... I once used a C compiler that had no math functions either (no cos, ... MFC is just another library, as I explained in an earlier post. ... other Microsoft proprietary libraries: ATL and compiler COM ...
    (microsoft.public.vc.mfc)
  • Re: linker error LNK2001: unresolved external symbol in VS2008 when building simple example
    ... AND 64 bit versions of these system libraries? ... Everything in your program should be using the same CRT settings and the same ... version of the compiler, ...
    (microsoft.public.vc.ide_general)
  • Re: "_acrtused" reference error during linking
    ... Run-Time (CRT) functions, which require the CRT startup code. ... It should be contained in one of the default libraries. ... >So I used the Win ME DDK's 16 bit compiler and link to build the module. ... >Object Modules: ...
    (microsoft.public.development.device.drivers)
  • Re: link with C runtime library
    ... be one of /Mxxx switches. ... Because C++ relies on CRT in many ways. ... This is not only legacy ... Compiler and CRT are tightly coupled. ...
    (microsoft.public.vc.language)
  • Re: Creating Dynamically loaded libraries
    ... > How can i create and use dynamic link libraries with ANSI or ISO C ... using switches to indicate that the function should not be ... virtually always need to inform the compiler explictly about this (in MSVC++ ...
    (comp.lang.c)