【Win32多线程】使用C runtime Library

c语言之简单的贪吃蛇 -- 详解以及源代码 1. 前言2. 题目描述3. 分析思路4. 编程所需知识5. 具体分析6. 完善7. 源代码8. 总结 阅读详情

如何避免使用 c runtime stdio 函数,改用Win32 Console API
如果使用MFC来开发程序,不要使用_beginthreadex()或CreateThread().若没有使用MFC,那么应该总是和多线程版本的C

Run-time Library 链接,并且总是以_beginthreadex()和_endthreadex()取代CreateThread()和ExitThread().
只要以_beginthreadex()取代CreateThread(),就可以在任何线程中安全的调用C runtime函数。
 Visual C++有两个版本的 C runtime library, 一个版本给单线程使用,一个版本给多线程使用。在MFC程序中必须使用

多线程版本的C runtime library。

Q:如何线程一套适当的 C run-time library?
 1.在VC的集成环境中选择
   a.选【Bulid/Setting】
   b.选【C/C++】
   c.在【Category】列表中选择Code Generation.
   d.拉下【Use run-time library】组合框
出现三个版本让你选择:
Single-Threaded(static),Multithreaded(static),Multithreaded DLL
每一个版本对应一个调试版本。当在【C/C++】选项中做了上面的更改,【Link】选项会自动的选择适当的函数库连接。
 2.命令行模式更改
 cl /MDd srcfile.c
 或cl /ML srcfile.c

Q:如何使用_beginthreadex()和_endthreadex()?
_beginthreadex()的参数和CreateThread()的参数完全相同。不过它已经把Win32的数据类型“净化”过了。
unsigned long _beginthreadex( void *security,
 unsigned stack_size,
unsigned ( __stdcall *start_address )( void * ),
 void *arglist,
unsigned initflag,
 unsigned *thrdaddr );

返回值传回线程的handle,此值必须被强制转换类型为Win32的HANDLE后才能使用。这个函数不是标准的ANSI C runtime

library 函数,不会在Unix或OS/2的编译器中找到这个函数。

一个简单的范例:
#include<windows.h>  //因为要调用CloseHandle()
#include<process.h>
unsigned _stdcall myfunc(void * p);
void main()
{
unsigned long thd;
unsigned tid;
thd=_beginthreadex(NULL,0,myfunc,0,0,&tid);
if(thd!=NULL)
{
CloseHandle(thd);
}

}

unsigned _stdcall myfunc(void *p)
{

}

另外还有一个C runtime函数,是和ExitThread()函数相对应,为_endthreadex().
如下:
void _endthreadex(unsigned );
不要在一个以_beginthreadex()启动的线程中调用ExitThread(),因为这样C runtime library就没有机会释放为该线程而

配置的资源了。

Q:什么时候使用_beginthreadex()而非CreateThread()?
要以C runtime library写一个多线程程序,必须使用1.多线程版本的C runtime library。2.使用_beginthreadex()和

_endthreadex().
因此,一个程序如果使用多个线程,而不在任何worker线程中调用 runtime library,应该能够与单线程版的runtime

library连接并以CreateThread取代_beginthreadex()。然而,C程序不调用任何的runtime library函数是不可能的。


如果主线程以外的任何线程进行以下操作,应该使用多线程版本的C runtime library,并使用_beginthreadex()和

_endthreadex().
 a.在C程序中使用malloc和free()或在C++中使用new 和delete.
 b.调用stdio.h或io.h中声明的任何函数。可以使用wsprintf()格式化字符串,就不需要stdio.h
 c.使用浮点变量或浮点运算函数
 d.调用任何一个使用了静态缓冲区的runtime函数。如asctime(),strtok(),rand();
 即如果worker线程没有使用上面那些函数,那么单线程版本的runtime library以及CreateProcess()都是安全的。

范例:worker线程搜文件中的一字符串worker线程使用fopen以及其他一些文件处理函数

/*
 *
 * Uses multiple threads to search the files 
 * "*.c" in the current directory for the string
 * given on the command line.
 *
 * This example uses the multithreaded version of
 * the C run-time library so as to be able to use
 * the FILE functions as well as calloc and free.
 *
 * Build this file with the command line: cl /MD SrchCrt.c
 *
 */

#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <process.h>    /* _beginthreadex, _endthreadex */
#include <stddef.h>
#include "MtVerify.h"

DWORD WINAPI SearchProc( void *arg );

#define MAX_THREADS 3

HANDLE hThreadLimitSemaphore;
char szSearchFor[1024];

int main(int argc, char *argv[])
{
    WIN32_FIND_DATA *lpFindData;
    HANDLE hFindFile;
    HANDLE hThread;
    DWORD dummy;
    int i;

    if (argc != 2)
    {
        printf("Usage: %s <search-string>\n", argv[0]);
        return EXIT_FAILURE;
    }

    /* Put search string where everyone can see it */
    strcpy(szSearchFor, argv[1]);

    /* Each thread will be given its own results buffer */
    lpFindData = calloc( 1, sizeof(WIN32_FIND_DATA) );

    /* Semaphore prevents too many threads from running */
    MTVERIFY( hThreadLimitSemaphore = CreateSemaphore(
            NULL,   /* Security */
            MAX_THREADS,    /* Make all of them available */
            MAX_THREADS,    /* No more than MAX_THREADS */
            NULL )          /* Unnamed */
         );

    hFindFile = FindFirstFile( "*.c", lpFindData );

    if (hFindFile == INVALID_HANDLE_VALUE)
        return EXIT_FAILURE;

    do {
        WaitForSingleObject( hThreadLimitSemaphore,
            INFINITE );

        MTVERIFY( 
            hThread = (HANDLE)_beginthreadex(NULL,
                        0,
                        SearchProc,
                        lpFindData,
                        0,
                        &dummy
            )
        );
        MTVERIFY( CloseHandle( hThread ) );

        lpFindData = calloc( 1, sizeof(WIN32_FIND_DATA) );

    } while ( FindNextFile( hFindFile, lpFindData ));

    FindClose( hFindFile );

    for (i=0; i<MAX_THREADS; i++)
        WaitForSingleObject(
                    hThreadLimitSemaphore,
                    INFINITE );
    MTVERIFY( CloseHandle( hThreadLimitSemaphore ) );

    return EXIT_SUCCESS;
}


DWORD __stdcall SearchProc( void *arg )
{
    WIN32_FIND_DATA *lpFindData = (WIN32_FIND_DATA *)arg;
    char buf[1024];
    FILE* fp;

    fp = fopen(lpFindData->cFileName, "r");
    if (!fp)
        return EXIT_FAILURE;

    while (fgets(buf, sizeof(buf), fp))
    {
        /* Inefficient search strategy, but it's easy */
        if (strstr(buf, szSearchFor))
            printf("%s: %s", lpFindData->cFileName, buf);
    }

    fclose(fp);
    free(lpFindData);

    MTVERIFY( ReleaseSemaphore( hThreadLimitSemaphore,
                1,          // Add one to the count
                NULL ) );   // Do not need the old value
}


---避免stdio.h
在没有stdio.h的情况下如何进行屏幕输出?
字符串格式问题,可由sprintf()的一个windows兄弟,名为wsprintf()来解决。wsprintf()分为_wsprintf()和

_wsprintfW(),前者处理ANSI字符串。后者处理Unicode字符串。这个函数是系统核心的一部分,和C runtime library没有

关系。
stdin 与stdout的替代品。
Win32之中也有完全对等与stdin,stdout,stderr的东西,可以使用API函数GetStdHandle()获取。
HANDLE GetStdHandle(
  DWORD nStdHandle   // input, output, or error device
);
参数nStdHandle必须是以下三个:
STD_INPUT_HANDLE Standard input handle
STD_OUTPUT_HANDLE Standard output handle
STD_ERROR_HANDLE

如何直接控制屏幕?
在Ms-Dos下可以用下面四种方法控制
a.利用BIOS显示中断服务程序
b.利用对视频显示缓冲区的直接读写
c.利用C runtime conio.h中的函数
d.利用C runtime stdio.h中的函数
应该使用Console API

使用Console API 取代stdio.h范例

#define WIN32_LEAN_AND_MEAN
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <time.h>       /* to init rand() */
#include "MtVerify.h"

/***********************************************
 * Constants
 */
#define MAX_THREADS  256

#define INPUT_BUF_SIZE      80
#define BANNER_SIZE         12
#define OUTPUT_TEXT_COLOR   BACKGROUND_BLUE | \
          FOREGROUND_RED|FOREGROUND_GREEN|FOREGROUND_BLUE

/**********************************************
 * Function Prototypes
 */
void MainLoop( void  );
void ClearScreen( void );
void ShutDownThreads( void );
void Prompt( LPCSTR str );    /* Display title bar info */
int StripCr( LPSTR buf );

/* Thread startup function */
DWORD WINAPI BannerProc( LPVOID pParam );

/**********************************************
 * Global Variables
 */
HANDLE  hConsoleIn;        /* Console input  */
HANDLE  hConsoleOut;       /* Console output */
HANDLE  hRunObject;        /* "Keep Running" event object */
HANDLE  ThreadHandles[MAX_THREADS];
int     nThreads;          /* Number of threads started */

CONSOLE_SCREEN_BUFFER_INFO csbiInfo;

/**********************************************
 * Stucture passed to thread on startup
 */
typedef struct {
    TCHAR buf[INPUT_BUF_SIZE];
    SHORT x;
    SHORT y;
} DataBlock;


/**********************************************
 * Primary thread enters here
 */
int main()
{
    /* Get display screen information & clear the screen.*/
    hConsoleIn = GetStdHandle( STD_INPUT_HANDLE );
    hConsoleOut = GetStdHandle( STD_OUTPUT_HANDLE );
    GetConsoleScreenBufferInfo( hConsoleOut, &csbiInfo );

    ClearScreen();

    /* Create the event object that keeps threads running. */
    MTVERIFY( hRunObject = CreateEvent(
            NULL,           /* Security */
            TRUE,           /* Manual event */
            0,              /* Clear on creation */
            NULL)           /* Name of object */
    );

    /* Start waiting for keyboard input to
     * dispatch threads or exit. */
    MainLoop();

    ShutDownThreads();

    ClearScreen();

    CloseHandle( hRunObject );
    CloseHandle( hConsoleIn );
    CloseHandle( hConsoleOut );

    return EXIT_SUCCESS;
}

void ShutDownThreads( void )
{
    if (nThreads > 0)
    {
        /* Since this is a manual event, all
         * threads will be woken up at once. */
        MTVERIFY( SetEvent(hRunObject) );
        MTVERIFY( WaitForMultipleObjects(
                    nThreads,
                    ThreadHandles,
                    TRUE, INFINITE
                ) != WAIT_FAILED
        );
        while (--nThreads)
            MTVERIFY( CloseHandle(
                    ThreadHandles[nThreads] ) );
    }
}

/* Dispatch and count threads. */
void MainLoop( void )
{
    TCHAR buf[INPUT_BUF_SIZE];
    DWORD bytesRead;
    DataBlock *data_block;
    DWORD thread_id;

    srand(time(NULL));
    for (;;)
    {
        Prompt(
            "Type string to display or ENTER to exit: "
        );
        MTVERIFY( ReadFile( hConsoleIn,
                        buf,
                        INPUT_BUF_SIZE-1,
                        &bytesRead,
                        NULL)
        );
        /* ReadFile is binary, not line oriented,
         * so terminate the string. */
        buf[bytesRead] = '\0';
        MTVERIFY( FlushConsoleInputBuffer( hConsoleIn ) );
        if (StripCr( buf ) == 0)
            break;

        if (nThreads < MAX_THREADS)
        {
            /*
             * Use the Win32 HeapAlloc() instead of
             * malloc() because we would need the
             * multithread library if the worker
             * thread had to call free().
             */
            data_block = HeapAlloc(
                            GetProcessHeap(),
                            HEAP_ZERO_MEMORY,
                            sizeof(DataBlock) );
            strcpy(data_block->buf, buf);

            /*
             * Pick a random place on the screen to put
             * this banner. You may not call rand in the
             * worker thread because it is one of the 
             * functions that must maintain state
             * between calls.
             */
            data_block->x = rand()
                * (csbiInfo.dwSize.X - BANNER_SIZE)
                / RAND_MAX;
            data_block->y = rand()
                * (csbiInfo.dwSize.Y - 1)
                / RAND_MAX + 1;

            MTVERIFY(
                ThreadHandles[nThreads++] = CreateThread(
                        NULL,
                        0,
                        BannerProc,
                        data_block,
                        0,
                        &thread_id )
            );
        }
    }
}

int StripCr( LPSTR buf )
{
    int len = strlen(buf);
    for (;;)
    {
        if (len <= 0) return 0;
        else if (buf[--len] == '\r' )
            buf[len] = ' ';
        else if (buf[len] == '\n' )
            buf[len] = ' ';
        else break;
    }
    return len;
}


void ClearScreen( void )
{
    DWORD    dummy;
    COORD    Home = { 0, 0 };
    FillConsoleOutputAttribute( hConsoleOut,
            csbiInfo.wAttributes,
            csbiInfo.dwSize.X * csbiInfo.dwSize.Y,
            Home,
            &dummy );
    FillConsoleOutputCharacter( hConsoleOut,
            ' ',
            csbiInfo.dwSize.X * csbiInfo.dwSize.Y,
            Home,
            &dummy );
}


void Prompt( LPCSTR str )
{
    COORD   Home = { 0, 0 };
    DWORD   dummy;
    int len = strlen(str);

    SetConsoleCursorPosition( hConsoleOut, Home );
    WriteFile( hConsoleOut, str, len, &dummy, FALSE );
    Home.X = len;
    FillConsoleOutputCharacter( hConsoleOut,
            ' ',
            csbiInfo.dwSize.X-len,
            Home,
            &dummy );
}

/**********************************************************
 * Routines from here down are used only by worker threads
 */

DWORD WINAPI BannerProc( LPVOID pParam )
{
    DataBlock *thread_data_block = pParam;
    COORD     TopLeft = {0,0};
    COORD     Size = {BANNER_SIZE ,1};
    int       i, j;
    int       len;
    int       ScrollPosition = 0;
    TCHAR     OutputBuf[INPUT_BUF_SIZE+BANNER_SIZE];
    CHAR_INFO CharBuf[INPUT_BUF_SIZE+BANNER_SIZE];
    SMALL_RECT rect;

    rect.Left   = thread_data_block->x;
    rect.Right  = rect.Left  + BANNER_SIZE;
    rect.Top    = thread_data_block->y;
    rect.Bottom = rect.Top;

    /* Set up the string so the output routine
     * does not have figure out wrapping. */
    strcpy(OutputBuf, thread_data_block->buf);
    len = strlen(OutputBuf);
    for (i=len; i<BANNER_SIZE; i++)
        OutputBuf[i] = ' ';
    if (len<BANNER_SIZE) len = BANNER_SIZE;
    strncpy(OutputBuf+len, OutputBuf, BANNER_SIZE);
    OutputBuf[len+BANNER_SIZE-1] = '\0';

    MTVERIFY( HeapFree( GetProcessHeap(), 0, pParam ) );

    do
    {
        for (i=ScrollPosition++, j=0;
                j<BANNER_SIZE;
                i++, j++)
        {
            CharBuf[j].Char.AsciiChar = OutputBuf[i];
            CharBuf[j].Attributes = OUTPUT_TEXT_COLOR;
        }
        if (ScrollPosition == len)
            ScrollPosition = 0;

        MTVERIFY( WriteConsoleOutput(
                        hConsoleOut,
                        CharBuf,
                        Size,
                        TopLeft,
                        &rect)
        );

    /*
     * This next statement has the dual purpose of
     * being a choke on how often the banner is updated
     * (because the timeout forces the thread to wait for
     * awhile) as well as causing the thread to exit
     * when the event object is signaled.
     */
    } while ( WaitForSingleObject(
                            hRunObject,
                            125L
            ) == WAIT_TIMEOUT );

    return 0;
}

---结束进程
a.调用C runtime library的exit()函数
b.从main()返回系统

Windows下玩转DeepSeek-R1:Ollama+Docker配置RAGFlow的3种网络调试方案 本文详细介绍了在Windows环境下使用Ollama和Docker配置RAGFlow的三种网络调试方案,帮助开发者解决本地部署AI知识库系统时的网络隔离问题。通过host.docker.internal直连、自定义Docker网桥网络和端口映射与反向代理三种方法,实现DeepSeek-R1模型与RAGFlow的高效通信,提升本地AI应用的开发效率。 阅读详情

相关推荐

智能车实战——极速越野组GPS与惯导融合定位导航全解析

本文深入解析了智能车极速越野组中GPS与惯导模块的融合定位导航技术。通过对比GPS的全局定位与惯导的高频姿态感知,详细阐述了如何利用MM32SPN27主控,将两者数据融合以实现精准、实时的车辆控制。内容涵盖硬件选型、软件数据处理、PID控制及系统调试等实战环节,为智能车开发者提供了一套完整的解决方案。

pz8901234的博客 1203

Win32多线程 -- C Run-time Librariy

Win32多线程程序建议: 1. 以 _beginthreadex 取代 CreateThread 2. 以 _endthreadex 取代 ExitThread 3. 不要使用 _beginthread 和 _endthread 4. 不要在MFC程序中使用 _beginthread 或 CreateThread Windows区分单线程版本和多线程版本的 C Run-time Librariy , 多线程版本要使用 _beginthreadex 函数做初始化。如果任何线程中使用到了 C Run-ti.

cfz751740465的博客 389

Jetson Orin Nano Super开发板实战:视觉模型部署与性能优化指南

本文详细介绍了Jetson Orin Nano Super开发板在边缘AI视觉模型部署与性能优化的完整实战指南。内容涵盖JetPack 6.1环境配置、Docker容器化部署、YOLO11及Transformer模型的TensorRT优化技巧,并通过实测数据展示了性能提升与功耗管理策略,为开发者提供高效的视觉AI部署解决方案。

7h6j5k4l3的博客 1196

【C语言】控制台窗口图形界面编程(四):文本输出

00. 目录 文章目录00. 目录01. FillConsoleOutputAttribute函数02. FillConsoleOutputCharacter函数03. WriteConsoleOutputCharacter函数04. 综合实例 01. FillConsoleOutputAttribute函数 设置指定数量的字符单元格的字符属性,从屏幕缓冲区中的指定坐标开始。 函数声明: 设置指...

C/C++软件工程师、嵌入式软件工程师、物联网研发工程师、C/C++讲师、物联网讲师、嵌入式讲师、鸿蒙讲师---欢迎大家一起交流(私信添加博主微信) 5160

ADS中使用Momentum进行电源完整性分析示例

这个应用可以帮助工程师用更快的时间使用ADS Momentum完成PDN分析。该应用描述了利用ADS Momentum RF模拟器进行PDN分析的方法,大大缩短了计算时间。 该分析主要应用与高速数字设计。 在此应用中使用了以下ADS特性: ADS设计流程集成(ADFI)。 电磁协同仿真。 Momentum仿真。 仿真流程如下: 在Allegro中创建ADFI文件 要将Alleg...

zb6075_lb的专栏 7007

Intel Realsense windows安装与入门

realsense400系列介绍: https://www.intelrealsense.com/stereo-depth/?utm_source=intelcom_website&utm_medium=button&utm_campaign=day-to-day&utm_content=D400_learn-more_button realsense 435i介绍: ...

hanshuning的专栏 1万+

贪吃蛇,c,c++

学了c++半个学期了,自己动手做了一个游戏。(有什么不好的地方,欢迎指出)#include #include #include #include #include #include #include #include # pragma comment (lib, "Winmm.lib")//导入Winmm.lib库 using namespace std; int n

梧桐下的四叶草 1696

Allegro老鸟的20年效率秘籍:用YepEda Skill脚本实现PCB设计全流程自动化

本文分享了Allegro资深工程师20年效率秘籍,通过YepEda Skill脚本实现PCB设计全流程自动化。从封装建库到规则配置,再到DFM审核,YepEda Skill大幅提升设计效率,每天节省至少4小时重复劳动。文章详细解析了自动化工具链的核心功能,并提供了实战技巧和量化对比数据。

weixin_42546392的博客 238

安全的使用CreateThread()

/*uses multiple threads to search the files ".c" in the current directory for the string given on th command line; this example avoids most C run-time functions,so that it can use the single-threa

雪儿的专栏 821

PCL 基于强度的双边滤波【2026最新版】

基于强度信息的双边滤波代码实现、滤波前后点云未出现变化的原因以及获取带有强度pcd点云的方法。本文由优快云点云侠原创,博客长期更新,本文最近一次更新时间为:2026年5月24日。

点云侠的博客 29万+

日常工作记录---在虚拟机中进行slam建图

   今天是10月24号,首先祝各位程序员们节日快乐!!!    最近一周由于实习的原因,对ROS的探索学习,停滞了一段时间,所以今天也就没什么大的进展,本篇文章仅仅记录一下,我在虚拟机中进行slam建图可行性验证的过程,本篇文章同样使用古月学院《如何在Gazebo中实现阿克曼转向车的仿真》的课程资料来进行验证    下面各条之间并没有严格的顺序关系,每一条都是独立的,都是我在验证过程中的经验或者记录:    1、在运行roslaunch bringup racecar_gazebo_rviz.lau

慕羽★的博客 4828

【Win32 多线程程序设计基础第八章笔记】

本章是Win32多线程程序设计的核心章节之一,主要围绕“如何正确使用C Runtime Library(C运行时库)进行多线程开发”展开。如果你是完全没有多线程基础的新手,不必担心——本章会从“为什么需要多线程版CRT”“如何选择CRT版本”“线程启动函数的区别”等基础问题讲起,还会保留文档中形象的比喻和完整的代码例子,帮你一步步理解多线程开发中CRT的关键用法,避免常见的“线程安全”陷阱。

云小逸的博客 627

谱方法学习笔记-下(超详细)

《谱方法学习笔记》深入介绍了傅立叶谱方法在解决偏微分方程问题中的理论和实践,提供了清晰的步骤、Matlab代码以及对一维、二维波动方程等不同问题的解析,适合对谱方法感兴趣的学习者。

图灵的猫的博客 2853

Win32——_beginthread()、CreateThread()、_beginthreadex()

《Win32多线程程序设计》–Jim Beveridge & Robert WienerC runtime library参考:C Runtime Library 单线程版本: 当 C runtime library 于 20 世纪 70 年代产生出来时,内存容量还很小,多任务是个新奇观念,更别提什么多线程了。C runtime library 使用数个全局变量和静态变量,这可能在多线程程序中彼此

SangYang 877

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

C runtime Library And Standard C++ Library

VisualC 中的C运行时库浅析 1.概论  运行时库是程序在运行时所需要的库文件,通常运行时库是以LIB或DLL形式提供的。C运行时库诞生于20世纪70年代,当时的程序世界还很单纯,应用程序都是单线程的,多任务或多线程机制在此时还属于新观念。所以这个时期的C运行时库都是单线程的。  随着操作系统多线程技术的发展,最初的C运行时库无法满足程序的需求,出现了严重的问题。C运行时

JonnyWei的专栏 2684

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

跳出坑爹的 Runtime Library 坑

在 Windows 下进行 C++的开发,不可避免的要与 Windows 的底层库进行交互,然而 VS 下的一项设置 MT、MTd、MD 和 MDd 却经常让人搞迷糊,相信不少人都被他坑过,特别是你工程使用了很多第三库的时候,及容易出现各种链接问题。看一下下面这个错误提示: LIBCMT.lib(_file.obj) : error LNK2005:_initstdio already defi...

weixin_42564720的博客 9933

最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版

Part-E1-SDIO-Specification-Ver4.00-Final-120220.pdf:最新的sdio 4.0 spec 协议标准 带书签 高清完整PDF版,包括SDIO 接口的外设,SDIO 接口官方协议等。

多线程版本的RunTime Library

1、unsigned long _beginthreadex(void  *security,;相当于SECURITY参数unsigned stack_szie,;新线程的堆栈大小,以字节为单位unsigned (__stdcall *start_address)(void*)),;线程启动时所执行的函数。;对应的WIN32数据类型是LPTHREAD_START_ROUTINE

深未来技术 592

Visual Studio 设置里的Runtime Library

如下图所示,C++的工程里,C/C++ ----> Code Generation ----> Runtime LIbrary下一共有四个选项,这些代表什么意思呢 概念解析 在这方面,经常看到以下名词: Runtime Library MSVCRT libcmt.lib LIBC.LIB LIBCMT.LIB CRTDLL.LIB ...

alexhu2010q的博客 5198

C runtime library

转自http://hi.baidu.com/b5000/blog/item/b4f9138291e123a10df4d243.html 运行时库是程序在运行时所需要的库文件,通常运行时库是以LIB或DLL形式提供的。C运行时库诞生于20世纪70年代,当时的程序世界还很单纯,应用程序都是单线程的,多任务或多线程机制在此时还属于新观念。所以这个时期的C运行时库都是单线程的。   随

初学者的专栏 997

带你玩转 Visual Studio——带你跳出坑爹的 Runtime Library 坑

上一篇文章带你玩转 Visual Studio——带你理解微软的预编译头技术我们了解了微软的预编译头技术,预编译的方式让我们的工程编译的更加快速;本篇文章将继续介绍微软的另一项技术,也就是运行时库 Runtime Library。 在 Windows 下进行 C++的开发,不可避免的要与 Windows 的底层库进行交互,然而 VS 下的一项设置 MT、MTd、MD 和 MDd 却经常让人搞迷糊,相信不少人都被他坑过,特别是你工程使用了很多第三库的时候,及容易出现各种链接问题。看一下下面这个错误提示: L

guoduhua的专栏 932

第一篇 如何使用C Run-Time Library

一 C Run-Time Libraries的三种可用形式Win32 SDK提供了三种C Run-time library 的可用形式    LIBC.LIB: 单线程程序静态链接到运行时库    LIBCMT.LIB: 多线程程序静态链接到运行时库    CRTDLL.LIB: CRTDLL.DLL的导入库,支持多线程程序的链接。CTRDLL.DLL 本身是Windows NT的

faicker的专栏 2197

Runtime library, CRT

首先 ,看一句知乎的片段:https://www.zhihu.com/question/39858721/answer/83472146: “Lampson也在图灵奖获奖演讲时曾说过一句话:Any problem in computer science can be solved with another level of indirection. (有人也说是David Wheeler说...

Peace 372

C Runtime Library(CRT Library)

C Runtime是windows平台下的一个概念。一般来说,CRT函数(C Runtime函数)就是标准的C语言函数。例如,printf、scanf、strlen、fopen等函数就属于CRT函数。在windows下所有的CRT函数最终都是转化成为win32 API来执行的。windows本身并没有在内核之上提供对CRT的支持。      CRT既可以通过静态连接来实现,也可以通过动态链接来实

910

CRT (C run-time library)

一 产生 运行时库是程序在运行时所需要的库文件,通常以LIB或DLL形式提供。 C运行时库就是C run-time library,诞生于20世纪70年代,是C而非C++语言世界的概念,C程序运行时需要这些库中的函数。 C 语言是所谓的“小内核”语言,就其语言本身来说很小(不多的关键字,程序流程控制,数据类型等)。所以,C语言内核开发出来之后,Dennis Ritchie和Brian Ker

maomaokuaile的专栏 1773
上一篇: 【win32多线程】数据的一致性问题,即多个线程读写数据问题
下一篇: 【win32多线程】使用C++编写多线程
xiaoding133
博客等级 码龄19年 415粉丝 159原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值