Real Software Forums

Using Managed (.NET2) DLL in RB
Page 1 of 1

Author:  Tgfs [ Fri Mar 01, 2013 8:51 am ]
Post subject:  Using Managed (.NET2) DLL in RB

I am trying to interface to a USB IC with the DLL provided by the manufacturer. They gave a VB.NET example to get started, but I am unsure how to set up the entry point of the DLL in RB.
Here is the beginning of their example:

Imports System
'//STEP 1:
'// Add the DLL as a reference to your project through "Project" -> "Add Reference"
'// menu item within Visual Studio
Imports MCP2210 '//<---- Need to include this namespace
Module Module1
Sub Main()
Dim MCP2210_VID As UInt32 = &H4D8 '// VID for Microchip Technology Inc.
Dim MCP2210_PID As UInt32 = &HDE '// PID for MCP2210
Dim isConnected As Boolean = False '// Connection status variable for MCP2210
'//STEP 2:
'// Make an instance of the MCP2210.DevIO class by calling
'// the class constructor with the device VID and PID.
Dim UsbSpi As MCP2210.DevIO = New DevIO(MCP2210_VID, MCP2210_PID)
'//STEP 3:
'// Navigate the DLL classes to find your desired function. In this case,
'// we choose to check the connection status.
isConnected = UsbSpi.Settings.GetConnectionStatus()

I have used declare statements to access the functions, but of course they don't work because I have not set up the entry point (DevIO) properly.
Am I missing something simple?

Author:  swort [ Mon Mar 04, 2013 1:53 pm ]
Post subject:  Re: Using Managed (.NET2) DLL in RB

You can't use managed .net dll's.
Only c/c++ win32 dlls.

Author:  taylor-design [ Mon Mar 04, 2013 9:55 pm ]
Post subject:  Re: Using Managed (.NET2) DLL in RB

Some suggestions...

* If you can find a VB6 or non-.NET C/C++ example you can probably use the provided library and code.

* There's an open source C/C++ library here. If you can compile it for your target platform then you can probably make calls to it.

* I believe it's possible to write a wrapper for a .NET DLL and expose the features you need using Visual Studio. Then you could use the resulting wrapper in Real Studio.

Author:  Tgfs [ Wed Mar 06, 2013 8:54 am ]
Post subject:  Re: Using Managed (.NET2) DLL in RB

Thanks Daniel, number 3 may be my best bet for now. I wish these dlls could be used directly in RB, it is so much easier to deal with than VS. Also, big thanks for the second suggestion, I did not know that even existed.

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group