crt

CRT initialization and DLLMain

て烟熏妆下的殇ゞ 提交于 2020-01-23 01:35:23
问题 Quotes: From the document "Best Practices for Creating DLLs" http://download.microsoft.com/download/a/f/7/af7777e5-7dcd-4800-8a0a-b18336565f5b/DLL_bestprac.doc of Microsoft: "DLLs often have complex interdependencies that implicitly define the order in which they must be loaded. The library loader efficiently analyzes these dependencies, calculates the correct load order, and loads the DLLs in that order." [1] "(within DLLMain) Use the memory management function from the dynamic C Run- Time

Help Deadlock analysis

╄→尐↘猪︶ㄣ 提交于 2020-01-17 03:22:26
问题 The Deadlock occurs in my application when initialization of local static variable happens in the function called from DLLMain Entry point with param DLL_THREAD_DETACH. Below is Windbg analysis This is usually caused by another thread holding the loader lock. Following are the Locks Held. CritSec ntdll!LdrpLoaderLock+0 at 7c97e178 LockCount 3 RecursionCount 1 OwningThread 17e8 EntryCount d ContentionCount d *** Locked CritSec MSVCR80!__app_type+94 at 781c3bc8 LockCount 1 RecursionCount 1

哈夫曼树基本操作(暂无压缩文件功能版本)

限于喜欢 提交于 2020-01-15 07:34:53
# include "pch.h" # define _CRT_SECURE_NO_WARNINGS //避免strcpy()不能使用 # include <stdio.h> # include <iostream> # include <string.h> # include <iomanip> //需要控制格式 // 这个头文件是声明一些 “流操作符”的 //比较常用的有:setw(int);//设置显示宽度,left//right//设置左右对齐。 setprecision(int);//设置浮点数的精确度。 using namespace std ; using std :: strcpy ; typedef char * * HuffmanCode ; //哈夫曼编码存放的二维动态数组 typedef struct { int weight ; int parent , lchild , rchild ; } HTnode , * HuffmanTree ; typedef struct { char ch ; int weight ; } CharArray ; //1.选择权值最小的2个结点 void Select ( HTnode a [ ] , int n , int & s1 , int & s2 ) { //n个结点中找最小2个结点,s1最小,s2次小 for

What is the difference between crtbegin.o, crtbeginT.o and crtbeginS.o?

浪尽此生 提交于 2020-01-10 14:57:07
问题 I'm trying to link directly using ld to isolate a build problem. When I include /usr/lib/gcc/x86_64-linux-gnu/4.7/libstdc++.so , I get a few issues: ac-aaa.o: In function `__static_initialization_and_destruction_0': /usr/include/c++/4.7/iostream:75: undefined reference to `__dso_handle' ac-callback.o: In function `__static_initialization_and_destruction_0': /usr/include/c++/4.7/iostream:75: undefined reference to `__dso_handle' ... Searching for __dso_handle : $ grep __dso_handle /usr/lib/gcc

从VC6.0平台级到VS2008平台

余生颓废 提交于 2020-01-09 07:31:18
从VC6.0平台级到VS2008平台 最近在在把一些程序从VC6迁移到VS2008,由此而关注到一些这方面的知识,找了一些资料,根据自己遇到的一些情况,结合在一起,整理出来这篇文章,希望对以后有这方面工作的人多一些参考,如果大家还有可很享的可以跟贴。。。。 1、关于 #define WINVER 提到这个问题是因为,这里涉及到Winodws版本的定义。关于版本定义的关键无外乎为程序头文件中对于#define WINVER 和 #define _WIN32_WINNT 的使用,具体为: #define WINVER 0xXXXX #define _WIN32_WINNT 0xXXXX 该定义一般用于标示程序对运行环境的要求,另外在某些头文件中也有这样的宏定义。如果版本匹配的话就会在编译的时候将这些内容编译,否则就不编译。 定义正确的Windows版本,不仅关系到程序的正确编译,同时也关系到程序的正确运行;在升级的过程中,我就碰到了程序编译正确但运行出错的问题。 版本的定义关系到被编译到程序中的内容,这里主要是指系统提供的功能代码。Windows各个版本的功能虽然大差不差,但特定于某个系统功能还是存在的,于是关系到这些功能的API代码也就有所不一样。当我们在程序中定义了错误的系统版本,被编译进程序的内容便可能包含当前系统不支持的代码片段,这样的程序即使可能正确编译通过,但在运行的时候

解决VS2015中出现类似于error C4996: 'scanf': This function or variable may be unsafe的安全检查错误

回眸只為那壹抹淺笑 提交于 2020-01-08 09:18:10
用习惯了VS老版本的人当刚使用VS2013的时候可能总遇到类似于这样的错误: error C4996: 'scanf': This function or variable may be unsafe. Consider using scanf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. 原因是Visual C++ 2015 使用了更加安全的 run-time library routines 。新的Security CRT functions(就是那些带有“_s”后缀的函数) 这个问题一般使用以下几种解决办法: (1)scanf等类似的函数已经不太安全,要想保证程序的安全性,建议以后采用_s结尾的安全版本,但是很多以前的程序可能还是使用不安全的版本,那么下面给出去掉这种错误提示的几种办法。 (2)在VS中新建项目的时候去掉“安全开发生命周期(SDL)检查”即可将错误转变成警告,使得使用不安全版本也不影响编译和运行,如下图所示。 (3)在头文件包含的最前面,记住是最前面(在include的前面)加上:#define _CRT_SECURE_NO_WARNINGS这个宏定义即可,如下图所示。 (4)在编译的头文件最前面加上:#pragma

Correct way to distribute VC++ runtime files

久未见 提交于 2020-01-01 09:21:29
问题 I have an MFC application which I am trying to package for deployment. It seems to depend on the files 'msvcr90.dll', 'msvcp90.dll' and 'mfc90.dll'. What is the correct way to distribute these files? I can't use merge modules as my installer doesn't support them. I know I can run VCRedist_x86.exe, but I don't want to do this for various reasons. As far as I can see my only alternative is to install the files as Private Side-by-Side assemblies. Is this correct? According to http://msdn

Building Visual C++ app that doesn't use CRT functions still references some

孤者浪人 提交于 2020-01-01 05:15:45
问题 This is part of a series of at least two closely related, but distinct questions. I hope I'm doing the right thing by asking them separately. I'm trying to get my Visual C++ 2008 app to work without the C Runtime Library. It's a Win32 GUI app without MFC or other fancy stuff, just plain Windows API. So I set Project Properties -> Configuration -> C/C++ -> Advanced -> Omit Default Library Names to Yes (compiler flag /Zl ) and rebuilt. Let's pretend I have written a suitable entry point

What functions does _WinMainCRTStartup perform?

倖福魔咒の 提交于 2019-12-29 05:18:46
问题 This is part of a series of at least two closely related, but distinct questions. I hope I'm doing the right thing by asking them separately. I'm trying to get my Visual C++ 2008 app to work without the C Runtime Library. It's a Win32 GUI app without MFC or other fancy stuff, just plain Windows API. So I set Project Properties -> Configuration -> C/C++ -> Advanced -> Omit Default Library Names to Yes (compiler flag /Zl ) and rebuilt. Then the linker complains about an unresolved external

PostgreSQL index include - 类聚簇表与应用(append only, IoT时空轨迹, 离散多行扫描与返回)

好久不见. 提交于 2019-12-26 16:25:24
标签 PostgreSQL , 离散扫描 , IoT , append only , 类聚簇 , index include 背景 https://use-the-index-luke.com/blog/2019-04/include-columns-in-btree-indexes 当一次SQL请求需要返回较多行,或者需要扫描较多行(即使使用索引)时,如果这些行在HEAP表中并非密集存储,而是非常离散的存储,那么扫描的记录数越多,访问的BLOCK就越多,性能会比较差。 优化思路: 1、cluster ,密集存储 让数据按索引的顺序密集存储,减少回表时IO放大 2、聚簇表 表的顺序与索引顺序一致,类似的还有index only scan(索引中包含所有需要搜索的字段,不回表) 3、预聚合 预先将需要访问的多条数据聚合成一条,例如轨迹数据,按目标对象聚合(例如单车ID),原始数据为点记录(多表),聚合成轨迹(单条) 4、index include 在索引中,放入额外属性内容,搜索时不需要回表,例如 create index idx_t1_1 on t1 (id) include(c1,c2,c3,info,crt_time); create index idx_t2_1 on t2 (id,c1,c2,c3,info,crt_time); 以上两个索引的差异在哪里? 索引1