Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Articles by Release Mutex
Dll堆栈问题(Dll的静态变量与全局变量、vs的MT与MD) - 人类观察者 - 博客园
问题引入: dll有一个导出函数,函数参数是string&,string在函数内部被=赋值。在exe动态加载此dll,调用此导出函数后,会崩溃。 原因: 如果任何STL类的实现中使用了静态变量(我们无从得知但map、string存在此问题),且编译dll时,vc的运行库设置为MT或MTd,会静态链接VC的运行时库,这会导致采用静态链接的方式将导致生成的目标模块拥有独立的堆栈空间。即此静态变量在dll中有独立的一份,在任何加载此dll的exe中,也有独立的一份。 由于"谁申请,谁释放"的原则,如果按照上面的情景,由于string在dll的函数内部被赋值,因此是由dll去申请的内存。但是因为string&传递了出去,在exe中使用,是由exe释放的string。因此会导致崩溃。 解决方法: 方法1.如果任何STL类内部使用了静态变量(无论是直接还是间接使用),那么就不要再写出跨执行单元访问它的代码。 方法2.对于跨模块使用string&,改为使用WCHAR* 方法3.编译dll时,修改vc的运行库为MD或MDd,这样堆栈空间就是共享的了。 /MD 与 /MT、/MTd与/MDd的区别...
Winduino: A tool to prototype Arduino projects on the PC
Download winduino.zip - 11.2 KB Download the latest from GitHub Introduction This started on a lark. I just wanted to see if my graphics and user interface libraries would run on a Windows PC. To that end I created a mechanism by which to draw to a window using DirectX and then I tied my user interface code and graphics code into it. It wasn't very useful by itself, but I thought to myself, "hey, this could be a useful prototyping tool with a little work" and here we are.
Winduino: A tool to help prototype user interfaces in Arduino projects on the PC
Download winduino.zip - 11.2 KB Download the latest from GitHub Introduction This started on a lark. I just wanted to see if my graphics and user interface libraries would run on a Windows PC. To that end I created a mechanism by which to draw to a window using DirectX and then I tied my user interface code and graphics code into it. It wasn't very useful by itself, but I thought to myself, "hey, this could be a useful prototyping tool with a little work" and here we are.
windows编程之线程同步万字总结(创建线程,互斥对象,互斥事件,信号量,关键段,多线程群聊服务器)_pp不会算法^v^的博客-CSDN博客
创建线程 window创建线程的方法有两种 方法一_beginthreadex 所在头文件: #include<process.h> 函数原型: uintptr_t _beginthreadex( void *security, unsigned stack_size, unsigned ( __clrcall *start_address )( void * ), void *arglist,/要传递到新线程的参数列表或 NULL。 unsigned initflag, unsigned *thrdaddr ); 线程函数示例: unsigned WINAPI 函数名称(void*arg) { .........
Windows 共享内存实现进程间通讯
在 windows 中 使用 CreateFileMappingW , MapViewOfFile 函数实现共享内存的创建和挂载。 使用了 CreateEvent , CreateMutex 函数实现进程间的互斥通讯 创建共享内存 CreateFileMapping 具体介绍: MSDN CreateFileMappingW 具体介绍可以看上方的官方文档这里不过多赘述,不过有一点需要提一下。 CreateFileMapping函数有两种 1.CreateFileMappingW 2.CreateFileMappingA 查了一下资料,好像只有最后一个参数不一样,一个是w_char*的宽字符类型, 一个是 char* 的类型, Windows api 的底层调用好像都是 w_char* 的,CreateFileMappingA 函数只是对字符类型做了一个转换再调用CreateFileMappingW,具体的我也没有仔细了解。 string 转 w_char* LPCWSTR stringToLPCWSTR(const char* orig) { size_t origsize =...
Show More
loading
Actions
Is this you?
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.Get in touch with Release
Contact Release, search articles and posts on X, monitor coverage, and track replies from one place.
Learn more about Muck Rack