Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the C++ equivalent for the CRT?

Tags:

c++

c

windows

I am new to C++, but I have worked with C before.

A program written in C must be linked with the CRT (in Windows, it is the file libcmt.lib) which contains the C functions (for example: printf()).

But I am wondering, is there such a thing as "C++RT" (as opposed to CRT), I mean where are the C++ functions and classes (for example: std::ofstream) stored.

And I have another question, if I used some C functions (for example: printf()), will my C++ program be linked with both the CRT and the "C++RT", or does the "C++RT" contains the CRT?

like image 454
user8240761 Avatar asked Jul 06 '17 16:07

user8240761


People also ask

What is CRT in C?

The C runtime Library (CRT) is the part of the C++ Standard Library that incorporates the ISO C standard library. The Visual C++ libraries that implement the CRT support native code development, and both mixed native and managed code. All versions of the CRT support multi-threaded development.

What are CRT functions?

Cardiac resynchronization therapy (CRT) is treatment to help your heart beat with the right rhythm. It uses a pacemaker to restore the normal timing pattern of the heartbeat. The CRT pacemaker coordinates how timing of the upper heart chambers (atria) and the lower heart chambers (ventricles).

What is Libcmt?

For example, libcmt is implementations of the C standard library provided with Microsoft's compiler. They provide both "debug" and "release" versions of three basic types of libraries: single-threaded (always statically linked), multi-threaded statically linked, and multi-threaded dynamically linked.

What is _DllMainCRTStartup?

The _DllMainCRTStartup function performs essential tasks such as stack buffer security set up, C run-time library (CRT) initialization and termination, and calls to constructors and destructors for static and global objects.


1 Answers

This depends on an exact implementation of C++ standard library you are using.

GCC ships with libstdc++ and your program is automatically linked against libstdc++*.so* or libstdc++*.dll* (filename may vary depending on distribution, build options and version used)

Clang/LLVM ships with libc++ and libc++*.so* on Linux and OS X, but uses Visual C++ library on Windows.

Microsoft Visual C++ links against one of the libcp*.lib or mscp*.lib (and associated .dll) depending on configuration (link).

Note that it is often possible to use non-default Standard library implementation. For example Clang can use either libstdc++ or libc++ on Linux. Intel compiler uses Microsoft library on Windows and libstdc++ on Linux. There are (were) also implementations that are not associated with a particular compiler, like STLport.

like image 160
Ivan Aksamentov - Drop Avatar answered Sep 18 '22 22:09

Ivan Aksamentov - Drop