Hey,

I have a c++ dll that returns a string.
Whenever I call it from vb.net, I get the pinvoke error.

This is how I declare the function. I thought marshalling the return type would fix it, but I still get the error. Am I doing something wrong?

VB Code:
  1. Declare Function dllBuildSurfaceStr Lib "Chart32.dll" Alias "BuildSurfaceStr" (ByVal nTooth As Long, ByVal Surfs As Long) As <MarshalAs(UnmanagedType.LPWStr)> String

Thanks in advance to all that reply,