all groups > dotnet clr > june 2006 >
You're in the

dotnet clr

group:

Forcing x86 runtime on x64 system


Re: Forcing x86 runtime on x64 system David Browne
6/21/2006 11:03:02 AM
dotnet clr:
[quoted text, click to view]

The only way I know to do this is to build your own launcher application,
load the 3rd party application assembly and run its main method.

EG
Compile the following with x86 target:


using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.Reflection;

namespace Run32bit
{
class Program
{
static void Main(string[] args)
{
try
{
string target = @"c:\program files\Whatever\whatever.exe";
Assembly target = Assembly.LoadFile(target);
target.EntryPoint.Invoke(null, new object[] { args });
}
catch (Exception ex)
{
Console.WriteLine(ex);
}


}
}
}



David
Forcing x86 runtime on x64 system Thomas Krause
6/21/2006 3:02:48 PM
Hello,

I have the following problem:

I have a .net 2.0 application, which dynamically loads a Managed C++
assembly. The managed c++ assembly has the ProcessorArchitecture correctly
set to x86 (32 Bit). The application however does not have the 32Bit-Corflag
set and is therefore loaded by the x64 version of the .net framework runtime
(64 Bit). So when the application tries to load the Managed C++ assembly I
get an exception, because it cannot use the 32 Bit managed C++ assembly in
the 64 Bit application.

So I need a way to force the os to load an assembly with the 32 Bit runtime
and not the 64 Bit runtime. I know that I can use the "corflags" application
in the SDK to set the 32Bit-Flag, but since the application is a strong
signed 3rd party application it does not allow me to do this (and since I
don't have the source code I cannot recompile it either).

Thanks,
Thomas Krause
Re: Forcing x86 runtime on x64 system Thomas Krause
6/22/2006 5:28:50 PM
Interesting idea! I will try that.

Thanks for your help,
Thomas Krause

[quoted text, click to view]
Re: Forcing x86 runtime on x64 system Willy Denoyette [MVP]
6/24/2006 2:00:49 PM
Your application need to target X86 (/platform:x86 option in C#, linker
option /Machine:x86 for C++)

Willy.

[quoted text, click to view]
| Hello,
|
| I have the following problem:
|
| I have a .net 2.0 application, which dynamically loads a Managed C++
| assembly. The managed c++ assembly has the ProcessorArchitecture correctly
| set to x86 (32 Bit). The application however does not have the
32Bit-Corflag
| set and is therefore loaded by the x64 version of the .net framework
runtime
| (64 Bit). So when the application tries to load the Managed C++ assembly I
| get an exception, because it cannot use the 32 Bit managed C++ assembly in
| the 64 Bit application.
|
| So I need a way to force the os to load an assembly with the 32 Bit
runtime
| and not the 64 Bit runtime. I know that I can use the "corflags"
application
| in the SDK to set the 32Bit-Flag, but since the application is a strong
| signed 3rd party application it does not allow me to do this (and since I
| don't have the source code I cannot recompile it either).
|
| Thanks,
| Thomas Krause
|

AddThis Social Bookmark Button