如何在vc++中使用。net dll ?

时间:2022-07-01 00:15:46

Please suggest me the best way to use .NET dll in VC++ project.

请建议我在vc++项目中使用。net dll的最佳方式。

3 个解决方案

#1


4  

Make it ComVisible. See link text

让它ComVisible。看到链接文本

#2


2  

If you make a Managed (CLR) VC++ project (I believe you can just set this in the compiler settings, though I'm not 100% sure if you need to change anything else in code to get it to work properly), you can use the .Net code without any "com" code, though you will have to write managed c++ code (this way you can also get the advantages of both managed .Net code as well as the advantages of standard c++)

如果你让一个托管(CLR)vc++项目(我相信你可以设置这个编译器设置,虽然我不是100%确定你需要改变代码中的其他事情让它正常工作),您可以使用. net代码没有任何“com”代码,尽管你将不得不编写托管c++代码(这样你也可以管理。net代码的优势以及标准c++)的优势

#3


2  

As an alternative, if you don't mind using the mono version instead of Microsoft, you can embed the mono runtime in your VC++ code (it's plain C) and use it to load the assembly and call methods, as described here.

作为替代方案,如果您不介意使用mono版本而不是Microsoft,那么可以将mono运行时嵌入到vc++代码中(它是普通的C),并使用它加载程序集和调用方法,如本文所述。

#1


4  

Make it ComVisible. See link text

让它ComVisible。看到链接文本

#2


2  

If you make a Managed (CLR) VC++ project (I believe you can just set this in the compiler settings, though I'm not 100% sure if you need to change anything else in code to get it to work properly), you can use the .Net code without any "com" code, though you will have to write managed c++ code (this way you can also get the advantages of both managed .Net code as well as the advantages of standard c++)

如果你让一个托管(CLR)vc++项目(我相信你可以设置这个编译器设置,虽然我不是100%确定你需要改变代码中的其他事情让它正常工作),您可以使用. net代码没有任何“com”代码,尽管你将不得不编写托管c++代码(这样你也可以管理。net代码的优势以及标准c++)的优势

#3


2  

As an alternative, if you don't mind using the mono version instead of Microsoft, you can embed the mono runtime in your VC++ code (it's plain C) and use it to load the assembly and call methods, as described here.

作为替代方案,如果您不介意使用mono版本而不是Microsoft,那么可以将mono运行时嵌入到vc++代码中(它是普通的C),并使用它加载程序集和调用方法,如本文所述。