Firstly, you should normally use System.IntPtr for opaque pointer types when using VB.NET. This will help you if you ever port to 64-bit (the IntPtr type is 32 bit in a 32-bit process but 64 bits in a 64-bit process). As for CP2101_GetProductString, if the C/C++ code is interpreting the lpvDeviceString parameter as a string, you should use
Public Declare Function CP2101_GetProductString Lib "CP2101.dll" ( _
ByVal DeviceNum As Long, _
ByVal DeviceString As String, _
ByVal Options As Long) As Integer
ByRef indicates an in/out parameter. If the function alters this data, you should use a StringBuilder object instead (still passed ByVal), and set its Capacity to the maximum size you expect the function to write. If you're getting MissingMethodExceptions, your DLL's exports may be mangled. To verify this, use dumpbin /exports. If the output contains ? characters and no recognisable function names, the names are mangled. You have two choices. Either you can rewrite your declarations to use the DllImportAttribute rather than Declare, and use the EntryPointName property to indicate the mangled name, or you can specify extern "C" in front of the exported function declarations to tell the compiler not to mangle the names. Remember that the latter will break binary compatibility with any existing clients. Stability. What an interesting concept. -- Chris Maunder