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

查看:66
本文介绍了在 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天全站免登陆