c++ - 32位编译器编译的库和64位编译器编译的库相互兼容吗?
天蓬老师
天蓬老师 2017-04-17 12:59:07
0
3
1259

64位编译器编译的指针是8bits 32位编译器编译的指针为4bits 如果一个程序里面同时用到了64位和32位的库(比如64位的Qt和32位编译器编译的boost cl.exe貌似默认就是32位 但好像没和64位qt起冲突) 它俩会不会不兼容? 求大神给我讲讲 64位 32位 除了能取更多的内存地址 还有什么要注意的。。。

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(3)
小葫芦

There should be no problem with 32-bit library upward compatibility
64-bit backward compatibility is basically difficult
A few points to note
First, the length of the moving pointer must be sizeof, so recompiling is not necessary. Changed
Second, it is actually very similar to long in 64, which is equivalent to long long of 32 in 64 bits. If long is assigned to int, it will cross the boundary. Also, do not assign pointers to integers and it will also fail.
Third assembly code If you embed assembly it may not be compatible with each other

Let’s put it this way, it’s best if your library can support 64 and 32 compilation

左手右手慢动作

Generally speaking, 32-bit libraries can be used on 64-bits (there are exceptions, such as when storing pointer addresses as numeric types, if you use int type on 64-bits, it will overflow), but 64-bit libraries Library not available on 32-bit

巴扎黑

A 32-bit process can only load 32-bit libraries, and a 64-bit process can only load 64-bit libraries. For 32-bit, the length of the pointer is usually 4 bytes, not 4bits. The CPU can write 4 bytes with one instruction; with 64-bit, the CPU can write 8 bytes with one instruction. On Windows with x86 series (including x86_64) CPUs, 32-bit processes can run on 64-bit operating systems, while 64-bit processes can only run on 64-bit operating systems.
You are talking about 64-bit qt and 32-bit compiled boost. Does 64-bit refer to qt creator?
Are you sure that the qt library you use is 64-bit and boost is compiled with x86? It is impossible to mix

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!