wrxhokie
March 9th, 2009, 03:29 PM
I'm having trouble passing strings to a C++ DLL from my vb.net program. I get constant Read/Write memory error exceptions. My C++ code is as follows:
char * get_signal_desc(char * dev)
{
bool status;
char * desc;
status = get_dev_signal_desc(dev, desc);
return desc;
}
And i'm using this function in my vb.net code as follows:
Public Declare Function get_signal_desc Lib "Core_Wrapper.dll" (ByVal sig As String) As String
Dim sig As String
Dim desc As string
desc.= Space(255)
sig = "MRG31025"
desc = get_signal_desc(sig)
MessageBox.Show(desc.ToString)
I get the exception at the line where i call the C++ function. Can anyone help me figure out how to pass strings between a C++ DLL and vb.net program?
char * get_signal_desc(char * dev)
{
bool status;
char * desc;
status = get_dev_signal_desc(dev, desc);
return desc;
}
And i'm using this function in my vb.net code as follows:
Public Declare Function get_signal_desc Lib "Core_Wrapper.dll" (ByVal sig As String) As String
Dim sig As String
Dim desc As string
desc.= Space(255)
sig = "MRG31025"
desc = get_signal_desc(sig)
MessageBox.Show(desc.ToString)
I get the exception at the line where i call the C++ function. Can anyone help me figure out how to pass strings between a C++ DLL and vb.net program?