Original Post
Hello. I have a large library in native C++ that I wish to use from a new C# windows application I am writing. I am trying to ascertain my options. It would seem that if the native code is a DLL then I can use System.Runtime.InteropServices and the DllImport attribute class to create a function declaration that I can use directly in C# for my C++ functions. But what if I don't want to convert my library to a DLL and leave it as is. Is this possible? Secondly, if I want to access types in this native static library, am I right in thinking I can only do this via a managed C++ wrapper object? I have no desire to actually access the internals of the types exposed in the native lib only to hold pointers / references to an instance and then pass it to various functions in the lib from the C# app. Thirdly, would it be better to use managed C++ as a proxy in this example? And just redefine managed versions of my types ( wrap them ) in managed C++ so that C# could just get them from the managed C++ assembly, and then also redefine managed functions that simply call the native ones that I want? In this case...am I right in thinking that the native lib could stay as a static lib, the managed assembly would be a "dll" ( in .NET terms an assembly ) that then statically links to the native lib. Thanks for help and advice.