Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different platform AppDomains in one .Net process?

I am interesting in: can i load 32bit x86 dll as a second AppDomain into 64 bit application environment?

For more details:

1) Main exe is 64 bit C# pure .net 4 app;

2) Module is third party .net 2.0 wrapper of some unmanaged x86 dll;

So can i create second 32bit AppDomain in 64bit .net 4 process and load 32bit module into new created 32bit AppDomain? And then marshal between default 64bit AppDomain and second 32bit AppDomain?

Thank you for any advice!

like image 289
Edward83 Avatar asked Nov 15 '10 16:11

Edward83


People also ask

What is appdomain in processes?

In short, any process running a managed application will have at least one app domain in it. Since AppDomain is a .NET concept, any process running unmanaged code will not have any application domain. Figure 2 will help you understand the concept better. Figure 2

What is the difference between a process and an app domain?

AppDomain can be considered as a light-weight process. Application domain is a .NET concept whereas process is an operating system concept. Both have many characteristics in common. A process can contain multiple app domains and each one provides a unit of isolation within that process.

How many application domains does a process have?

Since AppDomain is a .NET concept, any process running unmanaged code will not have any application domain. Figure 2 will help you understand the concept better. Figure 2 Process A runs managed code with one application domain while Process B runs managed code has three application domains.

What is app domain in NET Framework?

In this article, I am going to discuss App Domain in .NET Framework and in what scenarios we need them with examples. Please read our previous article where we discussed Assembly, DLL, and EXE in detail. The App Domain (Application Domain) in the .NET Framework is a logically isolated container inside which the .NET Code runs.


1 Answers

That's not possible, bitness is a process property, not an appdomain property. To make this work, you'll need to load that DLL in a separate process. Use the standard .NET IPC mechanisms to talk to it. Named pipes, sockets, remoting, WCF. Or force the Platform target setting to x86.

like image 79
Hans Passant Avatar answered Oct 06 '22 00:10

Hans Passant