可32位和64位合作? [英] Can 32 bit and 64 bit work together?

查看:223
本文介绍了可32位和64位合作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以在32位应用程序的64位图书馆的工作?例如,我的应用程序界面采用32位的Qt。而我的业务的核心是一个64位的库。该操作系统是64位。他们能一起工作怎么样?谢谢你。

Can 64 bit library work in a 32 bit application? For example, my application GUI uses 32 bit Qt. And my business core is a 64 bit library. The OS is 64 bit. Can they work together and how? Thanks.

推荐答案

简而言之:您可以将32位应用程序不能链接到64位库。

In short: You can't link a 32-bit app to a 64-bit library.

您可以运行32位应用程序,在64位操作系统上使用32位共享库(至少所有流行的32位/ 64位处理器,如AMD,英特尔和Sparc)。但是,这并不涉及任何库。

You can run a 32-bit application, using 32-bit shared libraries on a 64-bit OS (at least all the popular 32-/64-bit processors such as AMD, Intel and Sparc). But that doesn't involve any libraries.

再回应:我曾参与(在郊区)的一些设计的64位Linux内核的x86的球队。有简单(相对于整个项目的讨论持续了好几个小时),一些讨论,如何可以在技术上进行这项工作。这样做的简短摘要的是,在64位有寄存器都在32位可用。还有一个存储器地址的问题和额外的32位寄存器。所有这些都可以解决假设自己知道,这是一个32位兼容的库。但是,我们基本上已经被写入是32位库64位库,以及那种我们已经失去了点。

Longer answer: I was involved (on the outskirts) of some of the teams that designed the 64-bit Linux kernel for x86. There were briefly (compared to the whole project, the discussions lasted quite a few hours) some discussion as to how you could technically make this work. The short summary of this is that in 64-bit there are registers that aren't available in 32-bit. There is also the problem of memory addresses and the extra 32-bits in registers. All of these CAN be solved supposing the library itself "knows" that it's a 32-bit compatible library. But then we basically have a 64-bit library that is written to be a 32-bit library, and we've kind of lost the point.

更多的寄存器可能不适用于某些处理器,但更大的地址/位范围寄存器的绝对适用于所有的32位和64位兼容的处理器。而且我不知道有任何单一的处理器,允许32位code调用64位的共享库或静态库。这是行不通的,除非code是专门写来应对这一点,这违背了一个通用的64位库,支持32位应用程序的目的。

The "more registers" may not apply to some processors, but the bigger address/bit-range of registers definitely apply to ALL 32- and 64-bit compatible processors. And I'm not aware of any single processor that allows a 32-bit code calling a 64-bit shared library or static library. It just doesn't work unless the code is specifically written to cope with that, which defeats the purpose of having a generic 64-bit library to support 32-bit apps.

编辑:

链接一个可执行单元,如上面的讨论可执行文件,共享库或静态库。这必须是所有的1位数,32或64 - 无混合。

The above discusses linking one executable unit, e.g. an executable file, a shared library or a static library. That has to be all "one bitness", either 32 or 64 - no mixing.

当一个过程,会谈到另一个过程(如在GUI应用程序,其显示从非GUI过程状态),只要这两个过程使用相同的协议[并且通常,IPC不允许通过指针无论如何,所以32位/ 64位的转换是不是大问题],你可以有一个过程,是32位的,另一个是64位的。

When a process that talks to another process (e.g. a GUI app which displays status from a non-GUI process that), as long as the two processes use the same protocol [and typically, IPC doesn't allow passing of pointers anyway, so 32-/64-bit conversion isn't as big an issue], you can have one process that is 32-bit and another that is 64-bit.

这篇关于可32位和64位合作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆