tags:

views:

64

answers:

3

Hi all,

I need to provide 32 and 64 bits version of my .dll for a customer. Do I need to generate 2 files? Or can a single one contain code for both architectures?

And for extra brownie points: does the same question apply for Mac libraries? Or the Universal Binary approach solve that issue?

Thanks in advance

Alex

+1  A: 

I believe that you will need to provide two different assemblies.

Kragen
+2  A: 

You will need to provide two different dlls.

msvcyc
And how would that work with static libraries? Can I link both of them to a single exe? Or should there be 2 exe, one 32bits and on 64bits? I'm getting lost ... :-)
vectorizor
You must have 2 executables.
msvcyc
+1  A: 

It depends on the platform and what is in the code.

With C/C++/... (native code) it will generally require different files, but some platforms may provide a way to package these together.

In "managed/visualised" systems (e.g. Java, .NET) you can have a single file that will work either way (the JIT/runtime handles the processor specific translation), but use of native interfaces (e.g. P/Inkvoke) will possibly fail in this case (e.g. structure field offsets change).

Richard
"but some platforms may provide a way to package these together."Could you give more details about this please? Does something like that exist on Windows?
vectorizor
Not on Windows (as far as I am aware). For an EXE not hard to do: build 64bit, build 32bit with 64bit as a resource. On 32bit start up, if on 64bit platform extract resource to file and then execute it. Wait on child process, when it is signalled (exited) delete the file. Clearly this will not work for dll's because the system needs to be able to load the right biitedness directly, unless (like .NET) you can create "Any CPU" assemblies which will load in either.
Richard