从C#类库导出函数 [英] Exporting functions from a C# class library

查看:118
本文介绍了从C#类库导出函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎么会导出一个C#类库定义的功能,同时使他们能够被导入,并呼吁从非托管C ++应用程序/ DLL?

How would I export functions defined in a C# class library, while enabling them to be imported to and called from an unmanaged C++ application/DLL ?

推荐答案

严格地说,你不能只是导出功能,你会在一个典型的.dll文件,为.NET .dll文件的并不是真正的.dll文件的所有。你只有三个选项是:

Strictly speaking, you can't just export functions as you would in a classic .dll, as .NET .dll's aren't really .dll's at all. Your only three options are:


  1. 使用托管C ++

  2. 暴露你的C#类作为COM对象和从你的C ++代码使用它们

  3. 的主机在C ++项目 .NET运行库,并通过与您的C#类交互。

  1. Use managed C++
  2. Expose your C# classes as COM objects and consume them from your C++ code
  3. Host the .NET runtime in your C++ project and interact with your C# classes through that.

这篇关于从C#类库导出函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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