2

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?

Community
  • 1
  • 1
Xian Nox
  • 368
  • 2
  • 11

2 Answers2

7

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.

cha0site
  • 10,517
  • 3
  • 33
  • 51
4

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).

Shiplu Mokaddim
  • 56,364
  • 17
  • 141
  • 187