使用VB.NET类库从C ++ DLL的最好方法? [英] Best way to use a VB.NET class library from a C++ DLL?
问题描述
我需要用我的VB.NET项目之一的C ++项目。两者之间的接口将是C ++ code实例化和调用方法上的.NET程序集对象之一。
I need to use one of my VB.NET projects in a C++ project. The interface between the two will be for the C++ code to instantiate and call methods on one of the .NET assembly objects.
这两种编译成DLL文件(然后是C ++ DLL从NTVDM为VDD加载,但是这可能是不相关的。)
Both compile to DLLs (and then the C++ DLL is loaded from the NTVDM as a VDD, but that's probably not relevant.)
如果可能,我想避免使用COM基于这一点,我需要不碰注册表部署。另外,我使用Visual Studio 2008的前preSS版本C ++和VB.NET。
If possible I would like to avoid using COM for this as I need to deploy without touching the registry. Also, I am using Visual Studio 2008 Express editions for both C++ and VB.NET.
请,什么是做到这一点的最好方法是什么?
Please, what is the best way to do this?
推荐答案
你真的需要本地C ++,也可以使用C ++ / CLI?
Do you really need native C++ or can you use C++/CLI?
如果你能做到这一切在C ++ / CLI,那么你会最终有一个纯.NET应用程序。
If you can do it all in C++/CLI, then you'll end up with a pure .NET application.
如果你需要'原生'C ++,那么你就可以创建一个包含一个程序集托管和非托管C ++直接从Visual Studio(原生C ++调用C ++ / CLI,然后通过调用你的VB.NET)。
If you need 'native' C++, then you can create an assembly that includes managed and unmanaged C++ directly from Visual Studio (the native C++ calls C++/CLI which then calls through to your VB.NET).
和,如果你愿意preFER有一大堆在一个单一的组件,你可以遵循的链接本地C ++到C#应用程序的。它应该为VB.NET工作了。
And, if you'd prefer to have the whole lot in a single assembly you can follow the instructions for linking native C++ into C# applications. It should work for VB.NET too.
和我深受Heege推荐专家C ++ / CLI(1-59059-756-7)
And I'd highly recommend "Expert C++/CLI" by Heege (1‐59059‐756‐7)
这篇关于使用VB.NET类库从C ++ DLL的最好方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!