0

I noticed on mac that some of my shared objects (dylib) are binaries with two architectures. I believe this can be achieved by separately compiling for i386 and x86_64, then using the lipo utility to create the universal executable

$ file /usr/lib/libpoll.dylib
/usr/lib/libpoll.dylib: Mach-O universal binary with 2 architectures
/usr/lib/libpoll.dylib (for architecture x86_64):   Mach-O 64-bit dynamically linked shared library x86_64
/usr/lib/libpoll.dylib (for architecture i386): Mach-O dynamically linked shared library i386

However as far as I have spot checked .dll files on my windows system, they are all of one architecture. Here are some ways to check the architecture a .dll was compiled for

Is there a way I can compile a single .dll file for two different architectures (ex. both x86_64 and i386)?

Community
  • 1
  • 1
user784637
  • 15,392
  • 32
  • 93
  • 156

1 Answers1

3

In Mac OS you can compile what is know as a fat binary or a multi architecture binary. That is not available in Windows. Unmanaged PE executable files are either 32 bit or 64 bit, but never both.

On the other hand, .net assemblies can be compiled for AnyCPU and will adapt to the bitness of their host.

But for unmanaged modules, it is one or the other.

David Heffernan
  • 601,492
  • 42
  • 1,072
  • 1,490