Click here to Skip to main content
15,038,345 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need to dynamically load a .NET managed assembly into a Unix/Linux shared object that itself exports four functions is C.

What I have tried:

I have an existing code base written in C# for .NET 5/Core 3 that I need to dynamically load into a shared object written in C running on Linux/Unix, and I can't find any information as to how that can be done.

There is no end of tutorials explaining how to load a native C library into a C# assembly (unmanaged to managed), and of course I can use C++/CLI to dynamically load a managed .NET assembly (managed to unmanaged) if running in Windows, but C++/CLI is not part of .NET Standard and so isn't an option when running in Linux/Unix.

I presume crossing the barrier from managed to unmanaged code in Linux/Unix is a problem that has already been solved, but if so, I can't find the solution.
Posted
Comments
Gerry Schmitz 20-May-21 16:25pm
   
Use a client-server arrangement (real or virtual) if you don't need an "instant" response.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900