Can 32-bit and 64-bit code be mixed? [duplicate]

假如想象 提交于 2019-12-02 01:56:51

问题


Possible Duplicate:
Linking 32-bit library to 64-bit program

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?


回答1:


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

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.




回答2:


No its not possible. You cant call any 32 bit lib from 64 bit code. You have to put them in different address space.

One way to utilize it is to use interprocess communication (pipe, socket etc).



来源:https://stackoverflow.com/questions/8862366/can-32-bit-and-64-bit-code-be-mixed

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!