Convert C# project into Dll for C++ project

我的未来我决定 提交于 2020-02-24 09:04:34

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!