views:

290

answers:

2

I'm having some trouble finding the syntax for making function calls to unmanaged DLLs in VB.NET. Is anyone familiar with this?

Let's just assume there's a function "Connected" in unmanaged DLL "Connector.DLL". I want to call this function by creating an abstract function call to it.

I've seen some code out there that looks something like

[DllImport("Connector.DLL")]
Public Shared Function Connect(ByVal intPort)

But that syntax doesn't work for me.

+1  A: 

Have you checked out pinvoke.net?

Jay Riggs
A: 

In Visual Studio, add a reference to this Dll.

In Code:

Dim vr as new COMDllClass()
vr.FunctionInDll()

EDIT per comment:

Try this code:

<DllImport("Connector.DLL")> _
Public Shared Function Connect(ByVal intPort)
Nate Bross
Unmanaged DLLs aren't applicable as visual studio references.
hypoxide
So this is not even a COM visible DLL? Then you'll likely need to write a COM wrapper and call that from Visual Basic.
Nate Bross