Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linking 32-bit library to 64-bit program

Tags:

I have a 32-bit .so binary-only library and I have to generate 64-bit program that uses it. Is there a way to wrap or convert it, so it can be used with 64-bit program?

like image 295
Krzysiek Goj Avatar asked Dec 22 '09 01:12

Krzysiek Goj


People also ask

How do I install a 32bit program on a 64-bit system?

if you want to go back to the 32-bit version of Windows, you'll need to download the media creation tool — the 64-bit one, if you're running the 64-bit version of Windows 10 — and use it to create 32-bit installation media. Boot from that installation media and reinstall the 32-bit version over the 64-bit version.

Will 32-bit and 64-bit combination compatible and will work together?

In short: You can't link a 32-bit app to a 64-bit library. You can run a 32-bit application, using 32-bit shared libraries on a 64-bit OS (at least all the popular 32-/64-bit processors such as AMD, Intel and Sparc). But that doesn't involve any libraries.

What happens if I install a 32bit program on 64 bit computer?

To put it in simple words, if you run a 32-bit program on a 64-bit machine, it will work fine, and you won't encounter any problems. Backward compatibility is an important part when it comes to computer technology. Therefore, 64 bit systems can support and run 32-bit applications.


2 Answers

No. You can't directly link to 32bit code inside of a 64bit program.

The best option is to compile a 32bit (standalone) program that can run on your 64bit platform (using ia32), and then use a form of inter-process communication to communicate to it from your 64bit program.

like image 69
Reed Copsey Avatar answered Oct 21 '22 19:10

Reed Copsey


For an example of using IPC to run 32-bit plugins from 64-bit code, look at the open source NSPluginWrapper.

like image 37
Zan Lynx Avatar answered Oct 21 '22 20:10

Zan Lynx