J
Joe
I am working on a VB project that has to use a C++ dll that provides some
look up function. The original VB6 code followed the example at
http://support.microsoft.com/kb/107750, but this is no longer applicable for
a number of reasons under VB 2008.
The issues that I am having are related to getting the structure memory to
match inthe VB calling routine. Instead of using:
[
Type MYSTRINGSTRUCT
str1 As String * 8
str2 As String * 8
End Type
]
I am using:
[
Dim c As Char = " "
Structure MYSTRINGSTRUCT
Public str1() As Char
Public str2() As Char
Public Sub new( c As Char )
str1 = new String( c, 8 ).ToCharArray()
str2 = new String( c, 8 ).ToCharArray()
End Sub
End Structure
]
When I look at the structure in the debugger the size looks right. When I
fire off the SizeOf operation I get a smaler value than expected. The size
matches my expectation for the size of a pair of string pointers.
How can I be sure that I am passing the correct reference to the structure
that will be viewed on the C++ side? Do I need to worry about instantiating
a copy of my structure in unmanaged memory space? How can I insure that the
memory for my string is properly part of the passed in structure?
Thanks in advance!
look up function. The original VB6 code followed the example at
http://support.microsoft.com/kb/107750, but this is no longer applicable for
a number of reasons under VB 2008.
The issues that I am having are related to getting the structure memory to
match inthe VB calling routine. Instead of using:
[
Type MYSTRINGSTRUCT
str1 As String * 8
str2 As String * 8
End Type
]
I am using:
[
Dim c As Char = " "
Structure MYSTRINGSTRUCT
Public str1() As Char
Public str2() As Char
Public Sub new( c As Char )
str1 = new String( c, 8 ).ToCharArray()
str2 = new String( c, 8 ).ToCharArray()
End Sub
End Structure
]
When I look at the structure in the debugger the size looks right. When I
fire off the SizeOf operation I get a smaler value than expected. The size
matches my expectation for the size of a pair of string pointers.
How can I be sure that I am passing the correct reference to the structure
that will be viewed on the C++ side? Do I need to worry about instantiating
a copy of my structure in unmanaged memory space? How can I insure that the
memory for my string is properly part of the passed in structure?
Thanks in advance!