简体   繁体   中英

CRT AND WIN32 API

hI,

I'm wondering under windows where the CRT lib is used. In each dll forming the win32 API? Only by software developped under visual studio ?

In other words, is Windows OS perform malloc, write/read on files and so on, by using other thing than CRT?

THanks

The C runtime (in case of Visual Studio 2010 msvcr100.dll) contains the implementation of the C standard library functions.

The C runtime is implemented in a platform-specific way, and in the Windows case, it uses functions from kernel32.dll (part of the Win32 API) to perform its tasks.

You can have a look at the exported and imported functions and DLL dependencies using Dependency Walker .

I have no idea what you wanted to ask in your first question. About the second though: CRT is not windows-specific but VS-specific. Your C programs that you compile with VS will use the MSVCRTxx DLLs to provide (most) C library functions. In turn, the C library functions will use the WINAPI to do actual stuff. The WINAPI is the last layer that talks to the OS.

Other compilers, such as g++ in MINGW will not use the MSVCRTxx DLLs but have their own. In the end, that will also use the WINAPI. For example, malloc will most likely call VirtualAlloc in any implementation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM