Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

c

32bit-64bit

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?

like image 291
Xian Nox Avatar asked Mar 03 '26 13:03

Xian Nox


1 Answers

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.

like image 52
cha0site Avatar answered Mar 06 '26 02:03

cha0site



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!