How to communicate with hosted CoreCLR?

The .NET Framework offers several ways to host a managed runtime. You can use mscoree.dll CorBindToRuntime ( https://msdn.microsoft.com/library/ms231419(v=vs.110).aspx ) to get the AppDomain handle via GetDefaultDomain / CreateDomain, and then load the assemblies, create object instances and call moporlib interop objects methods.

This method is deprecated, but a newer interface based on CLRCreateInstance ( https://msdn.microsoft.com/library/ms164408(v=vs.110).aspx ) provides similar capabilities. At some point you get access to COM-compatible object AppDomain and can communicate with managed code.

However, CoreCLR ( https://www.microsoft.com/net , https://github.com/dotnet/coreclr ) is missing mscoree.dll. The hosting method that allows you to execute part of the CoreCLR managed code is described in

http://www.fancy-development.net/hosting-net-core-clr-in-your-own-process

But the ICLRRuntimeHost / ICLRRuntimeHost2 interfaces do not provide a way to pass data to the called managed function, and I cannot get the calculation results. Thus, the method is applicable only if the code is called for its side effects.

What is the way to transfer data to and from managed code in CoreCLR?

+4
source share

Source: https://habr.com/ru/post/1657507/


All Articles