摘要:
1)#pragma data_seg()一般用于DLL中。也就是说,在DLL中定义一个共享的,有名字的数据段。最关键的是:这个数据段中的全局变量可以被多个进程共享。否则多个进程之间无法共享DLL中的全局变量。2)共享数据必须初始化,否则微软编译器会把没有初始化的数据放到.BSS段中,从而导致多个进程之间的共享行为失败。3)你所谓的结果正确是一种错觉。如果你在一个DLL中这么写: #pragma data_seg("MyData")int g_Value; // Note that the global is not initialized.#pragma data_seg( 阅读全文
posted @ 2013-01-26 21:13
CBDoctor
阅读(3615)
评论(0)
推荐(0)
该文被密码保护。 阅读全文
posted @ 2013-01-26 20:17
CBDoctor
阅读(2)
评论(0)
推荐(0)
摘要:
添加引用#include <iostream>using namespace std;AllocConsole();freopen("CONIN$", "r", stdin );freopen("CONOUT$", "w", stdout);freopen("CONERR$", "w", stderr);cout << "启动控制台/n/n";在析构函数中调用FreeConsole();intmain(intargc,char*ar 阅读全文
posted @ 2013-01-26 17:04
CBDoctor
阅读(267)
评论(0)
推荐(0)
浙公网安备 33010602011771号