在64位C ++程序中使用32位库 [英] Using 32-bit library in 64-bit C++ program

查看:793
本文介绍了在64位C ++程序中使用32位库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在64位系统中使用旧的32位静态库* .a。
没有机会获得此旧库的源代码以再次对其进行编译。
我也不想在gcc中使用-m32,因为该程序使用许多64位库。
谢谢。

Is there any way how use an old 32-bit static library *.a in a 64-bit system. The is no chance to obtain a source code of this old library to compile it again. I also do not want to use -m32 in gcc, because the program use many 64bit libraries. Thanks.

推荐答案

这完全取决于您所运行的平台。例如,在PowerPC上的OS X可以正常工作。

That depends entirely on the platform on which you're running. OS X on PowerPC, for example, that would "Just Work".

在x86平台上,您不能将32位库链接到64位可执行文件中。如果您确实需要使用该库,则需要启动一个单独的32位进程来处理对该库的调用,并使用某种形式的IPC在您的64位应用程序和该帮助进程之间传递这些调用。请预先警告:这很麻烦。在开始这条路之前,请确保您确实需要该库。

On x86 platforms, you can't link a 32-bit library into a 64-bit executable. If you really need to use that library, you'll need to start a separate 32-bit process to handle your calls to the library, and use some form of IPC to pass those calls between your 64-bit application and that helper process. Be forewarned: this is a lot of hassle. Make sure that you really need that library before starting down this road.

这篇关于在64位C ++程序中使用32位库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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