Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Deployment guideline (using regular DLLs)

Reply
 
Old 01-26-2009   #1 (permalink)
a non e mouse


 
 

Deployment guideline (using regular DLLs)

Is there a deployment guideline or suggestion for how dotnet
applications that include regular DLLs ?
If a DLL is compiled using a 32 bit compiler then the interop fails in
64 bit environments. The solution seems to be to
a) mark the dotnet application as a x86 application forcing it to run
in the 32 bit emulator
b) recompile the regular DLL with a 64 bit compiler
Presumably one needs to have two DLLs which are deployed by an
installer according to the target operating system, but one would have
expected a safer default handling of the situation.

My System SpecsSystem Spec
Old 01-27-2009   #2 (permalink)
Jeroen Mostert


 
 

Re: Deployment guideline (using regular DLLs)

a non e mouse <anon@xxxxxx> wrote:
Quote:

> Is there a deployment guideline or suggestion for how dotnet
> applications that include regular DLLs ?
> If a DLL is compiled using a 32 bit compiler then the interop fails in
> 64 bit environments. The solution seems to be to
> a) mark the dotnet application as a x86 application forcing it to run
> in the 32 bit emulator
This only applies to Itanium platforms. (Current) x64 platforms do not
emulate 32-bit software, they run it natively (with almost no performance loss).
Quote:

> b) recompile the regular DLL with a 64 bit compiler
> Presumably one needs to have two DLLs which are deployed by an
> installer according to the target operating system, but one would have
> expected a safer default handling of the situation.
Since interop does not link statically, you could always install both DLLs
with the application, test whether you're running as 32-bit or 64-bit at
runtime and copy the appropriate DLL under the expected file name before
doing interop.

This seems more trouble than it's worth, though. What's unsafe about
checking it at install time? People shouldn't expect to be able to move
installed applications to completely different architectures.

Note that if your .NET application does not require the extra memory that
comes with being a 64-bit application (and running under a 64-bit OS already
gives you 4 GB as opposed to 2 or 3 on a 32-bit OS), it's perfectly alright
to mark it as x86 and use the 32-bit implementation throughout. Your
application does not somehow become better when running as 64-bit.

--
J.
My System SpecsSystem Spec
Old 01-27-2009   #3 (permalink)
a non e mouse


 
 

Re: Deployment guideline (using regular DLLs)

Thanks for the guidance. The point was that I presume that native DLL
PIF headers indicate that they are 32 bit and one would expect
the .NET platform to recognize it instead of crashing on the interop
call.


On Jan 28, 12:50*am, Jeroen Mostert <jmost...@xxxxxx> wrote:

....
Quote:

> This seems more trouble than it's worth, though. What's unsafe about
> checking it at install time? People shouldn't expect to be able to move
> installed applications to completely different architectures.
....
Quote:

> --
> J.
My System SpecsSystem Spec
Old 01-28-2009   #4 (permalink)
Jeroen Mostert


 
 

Re: Deployment guideline (using regular DLLs)

a non e mouse <anon@xxxxxx> wrote:
Quote:

> The point was that I presume that native DLL PIF headers indicate that
> they are 32 bit and one would expect the .NET platform to recognize it
> instead of crashing on the interop call.
>
Do you mean it actually crashes, or does it throw an exception indicating
that the image is invalid (which is what I would expect)? The latter
behavior is par for the course when a 32-bit application tries to load a
64-bit DLL (or vice versa) and the runtime can't detect you're going to be
doing interop with an unloadable DLL (interop is fully dynamic, and there's
no equivalent of "static linking").

The .NET framework doesn't analyze the library itself, it relies on the OS
loading mechanisms. You'd basically see the same thing happening if an
unmanaged application tried to LoadLibrary() an incompatible DLL at runtime.
If the DLL were linked instead, the EXE would refuse to load.

--
J.
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Missing .DLLs Vista General
Help with Deployment Workbench and Deployment Services Vista installation & setup
Asp.net and library dlls .NET General
Micrsoft Deployment and Vista image deployment.... Vista installation & setup
DLLs in some Gadgets Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46