什么是C Runtime library?

THINK511 2004-03-30 03:50:54
什么是C Runtime library?它和windows 的API函数有什么区别和联系呢?我们在做程序的时候是使用C Runtime library好呢还是windows API好呢?
...全文
661 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
THINK511 2004-03-30
  • 打赏
  • 举报
回复
那我们在做程序的时候是使用C Runtime library好呢还是windows API好呢?我现在在看《windows系统编程》,书中说最好使用windowsAPI函数,因为好多已经运行的程序如explore等都已经使用了windowsAPI函数,所以在内存中已经存在了。这让我很困惑,难道说C Runtime Library在这个时候在内存中就不存在了吗?那还叫什么Runtime?
Caps77 2004-03-30
  • 打赏
  • 举报
回复
C Runtime library 是从c语言延续下来的一些函数,如strcpy,strlen等,适用于任何支持ANSI c的操作系统
而win api程序与windows操作系统交互的接口
rivershan 2004-03-30
  • 打赏
  • 举报
回复
see MSDN~

and

============
Windows应用程序调用的函数可分为C/C++运行时库函数以及Windows API函数两大部份。

Windows API大家都很熟悉了,那什么是C/C++运行时库呢?所谓C/C++运行时库(C/C++Run-time Library),就是由系统提供的一些库文件(可以是静态链接库,也可以是动态链接库),里面含有Windows应用程序所用的最基本和最常用的C/C++运行时库函数、应用程序初始化代码、错误处理代码(例如0做除数的处理)等。你写的程序可以没有MATHS.LIB,程序照样运行,只是不能处理复杂的数学运算,不过如果没有了C运行时库,main()就不会被调用,exit()也不能被响应。

在编写Windows应用程序的时候,默认情况下,系统会自动链接到这些C/C++运行时库之中去,调用一些C/C++运行时库中的函数对程序进行一些初始化工作,然后再来调用我们的应用程序中的Windows API函数。
bossmao 2004-03-30
  • 打赏
  • 举报
回复
C Run-Time Libraries
The following table lists the release versions of the C run-time library files, along with their associated compiler options and environment variables. Prior to Visual C++ 4.2, the C run-time libraries contained the iostream library functions. In Visual C++ 4.2 and later, the old iostream library functions have been removed from LIBC.LIB, LIBCMT.LIB, and MSVCRT.LIB. (This change was made because the Standard C++ library has been added to Visual C++, and it contains a new set of iostream libraries. Thus, two sets of iostream functions are now included in Visual C++.) The old iostream functions now exist in their own libraries: LIBCI.LIB, LIBCIMT.LIB, and MSVCIRT.LIB. The new iostream functions, as well as many other new functions, exist in the Standard C++ libraries: LIBCP.LIB, LIBCPMT.LIB, and MSVCPRT.LIB.

The Standard C++ library and the old iostream library are incompatible, and only one of them can be linked with your project. See Port to the Standard C++ Library and theStandard C++ Library Overview for details.

When you build a release version of your project, one of the basic C run-time libraries (LIBC.LIB, LIBCMT.LIB, and MSVCRT.LIB) is linked by default, depending on the compiler option you choose (single-threaded, multithreaded, or DLL). Depending on the headers you use in your code, a library from the Standard C++ libraries or one from the old iostream libraries may also be linked:

16,472

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧