RLT
RLT

Reputation: 4287

Cannot load 32 bit dylib from 64 bit process and vice versa on OSX?

I came across a problem yesterday where my program failed as 32 bit process.

I had a dylib compiled as 64 bit and I was using it on 64 bit application. But when I turned it to 32 bit for testing and tried to load it, it did not worked. dlopen() returned NULL?

Do I need to have 32 bit and 64 bit dylib for 32 bit and 64 bit binary respectively? Is there any work around?

Upvotes: 2

Views: 1398

Answers (2)

Parag Bafna
Parag Bafna

Reputation: 22930

  1. You can build 32-bit binaries with a 64-bit compiler, and vice versa.
  2. You can build and run 64-bit binaries when booted on a 32-bit kernel, and vice versa.
  3. You can't link 32-bit builds against 64-bit binaries or vice versa.

Upvotes: 2

Mat
Mat

Reputation: 206851

Yes, you need 32bit libs for 32bit processes, and 64bit libs for 64bit processes. There is no workaround.

Upvotes: 4

Related Questions