32 位和 64 位代码可以混合使用吗? [英] Can 32-bit and 64-bit code be mixed?

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

问题描述

可能的重复:
将 32 位库链接到 64 位程序 >

程序使用的需要静态链接的库之一是 32 位库.如果用 64 位编译器编译,它会中断,主要是因为变量类型的长度不同(大部分是 long 的两倍).提供了库的源代码.该程序本身可以在 32 位和 64 位上运行.是否可以将库编译为 32 位并将其静态链接到 64 位应用程序?

One of the libraries a program uses, which needs to be statically linked, is a 32-bit one. If compiled with a 64-bit compiler, it breaks, mostly because the variable types are of different length (long being twice as long, mostly). Source code of the library is provided. The program itself works at 32 and 64 bit. Is it possible to compile the library as 32-bit and statically link it to a 64-bit application?

推荐答案

基本上,不,您不能静态或动态链接 32 位和 64 位代码,无论如何都不能在 x86 上.

Basically, no, you can't link, statically or dynamically, 32bit and 64bit code, not on x86 anyway.

可以做的是编写一个在单独进程中运行的包装器,并使用 RPC 将库链接"到您的代码.nspluginwrapper 在 Linux 上对 Flash 执行类似的操作.

What you can do is write a wrapper that runs in a separate process and uses RPC to "link" the library to your code. nspluginwrapper on Linux does something like that for Flash.

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

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