将本机DLL和程序集合到一个DLL中 [英] Combine native DLL and assembly into a single DLL

查看:118
本文介绍了将本机DLL和程序集合到一个DLL中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在C ++和C#中编程。使用本机C ++进行数值计算。



本来我打算使用C ++ / CLI来创建一个包含本机C ++类的代码,但是我发现它会导致一个2〜4倍减速。



所以我决定将我的本地C ++编译成DLL,并通过 P / Invoke 。我将在C#中执行数据预处理,并在本机DLL中进行数字处理。



问题是,当我提供我的工作供别人使用时,我希望它是一个DLL。



这可能吗? BTW,我有本机C ++的所有源代码。

解决方案

您可以在.NET中混合使用同一程序集中的语言,但不能自然。



请参阅:



http://www.hanselman.com/blog/MixingLanguagesInASingleAssemblyInVisualStudioSamlessamlessWithILMergeAndMSBuild.aspx



我把不同语言的程序集分开。


I am currently programming in C++ and C#. Using native C++ for the numerical computing part.

Originally I intended to use C++/CLI to make a wrapper to the native C++ classes, but I found it would result in a 2 to 4 times slowdown.

So I decided to compile my native C++ to a DLL and call in .NET/C# via P/Invoke. I will do data preprocessing in C# and number crunching in the native DLL.

The problem is that when I deliver my work for others to use, I'd like it to be a single DLL.

Is this possible? BTW, I have all source code to the native C++.

解决方案

You can mix languages in the same assembly in .NET but not naturally. I would avoid this unless absolutely necessary.

See:

http://www.hanselman.com/blog/MixingLanguagesInASingleAssemblyInVisualStudioSeamlesslyWithILMergeAndMSBuild.aspx

I keep assemblies from different languages separate.

这篇关于将本机DLL和程序集合到一个DLL中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆