问题
I am a newbie to C#. I am currently working on learning C# code. My final goal is to convert a C# project into a dll so that I can use it in my C++ exe. I am using VS2005.
I was wondering if it's possible and if so I would appreciate for some guidance and suggestions in this regards,
Please do reply back,
回答1:
Why not to make a com object out of your managed lib and call it from the unmanaged c++ code? It's relatively easy to do if you know how to manage com in c++.. http://msdn.microsoft.com/en-us/library/aa645736(v=vs.71).aspx
回答2:
Write a C++/CLI wrapper around the C# DLL that exposes a native C++ interface to the C# code.
You'll probably need to enable the /clr
flag in your application, but there are ways to expose a completely native interface via a DLL too.
There is a good explanation and sample implementation of the various techniques at this link.
来源:https://stackoverflow.com/questions/5517088/convert-c-sharp-project-into-dll-for-c-project