views:

34

answers:

1

I would like to import a VB.net dll into C++/CLI. I am having trouble referencing my dll. I have tried to find tutorials but with no luck, in particular, I usually find how to import managed libraries directly into native code through COM. I would like to import an existing VB.net dll into my C++/CLI project.

Do I require a header file or a declaration file to import and use my vb.net dll? Any help/suggestions would be greatly appreciated.

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;
}
+1  A: 

Try looking at this discussion. Especially Kuldeep_s last post. It's about accessing a C# dll from unmanaged C++ via managed C++. If you skip the umanaged C++ bit it would match your scenarion (calling a C# DLL vs a VB.Net DLL shouldn't make any difference).

ho1
THANK YOU! I eventually want to link my vb.net dll to MATLAB. That link helped tremendously.
Shiftbit