byref strings c++ vb.net

  • Thread starter Thread starter marfi95
  • Start date Start date
M

marfi95

I'm trying to call a C++ component from my vb.net app. This method has
a prototype of int GetV (char *verData). I've setup a Declare
statement like the following:

Declare Auto Function GetV Lib "myread.dll" Alias "GetV" (ByRef vData
As String) As Integer. BTW, I've also tried ANSI and UNICODE.

I'm assuming this is correct, but when I call it from my VB.Net app, I
get an unhandled exception even though the vb code is within a try
block. I know the DLL returns a string, but I'm unsure how to pass
strings byref to c++ dlls. I'm not sure is the DLL is MFC or not since
it is not my DLL. Not even sure how to tell or if it even matters.

Any help would be appreciated.

Thanks,
Mark
 
Declare Auto Function GetV Lib "myread.dll" Alias "GetV" (ByRef vData
As String) As Integer. BTW, I've also tried ANSI and UNICODE.

The String parameter shoud be passed ByVal, not ByRef.



Mattias
 
Back
Top