开发者

VB.NET to C++/CLI: How do I import a VB.NET DLL file into C++/CLI?

I would like to import a VB.NET DLL file into C++/CLI. I am having trouble referencing my DLL file. I have tried to find tutorials but with no luck, in particular, I usually find how to import managed libraries directly int开发者_开发技巧o native code through COM. I would like to import an existing VB.NET DLL file into my C++/CLI project.

Do I require a header file or a declaration file to import and use my VB.NET DLL file?

Foo.vb

Public Module Foo
    Public Function Bar(ByVal a As Integer, ByVal b As Integer) As Boolean
        Return a > b
    End Function
End Module

Mixed.cpp

#include "stdafx.h"
#using "..\Foo\bin\Debug\Foo.dll"
using namespace System;

int main(array<System::String ^> ^args)
{
    bool i = Foo::Bar(10,1);
    Console::WriteLine(i);
    return 0;
}


Try looking at the discussion in Unmanaged C++ to C# interop (replacing CCW), especially Kuldeep_s last post. It's about accessing a C# DLL file from unmanaged C++ via managed C++. If you skip the umanaged C++ bit it would match your scenario (calling a C# DLL vs a VB.NET DLL shouldn't make any difference).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜