D
DLI
I tried a similar post in interop and got a blank stare.
Can ayone tell me how to pass an array of structures which contain arrays of
blittable types to unmanaged memory?
This syntax does not work:
Public Declare Sub SomeDll Lib "SomeDll.dll" ( ByRef MyStructure() as
SomeStructure, ByRef MyOutput as Int32)
I get junk on the dll side.
If I try to decorate the definition like this:
Public Declare Sub SomeDll Lib "SomeDll.dll" (
<MarshalAs.UnmanagedType,SafeArray>ByRef MyStructure() as SomeStructure,
ByRef MyOutput as Int32)
I get an exception the Type is not valid.
The structure has a definition similar to
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi, pack:=8)> Public
Structure SomeStructure
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Dim GasID() As Byte
Dim Mw As Double
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Dim CpPar() As Double '
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Dim MuPar() As Double
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Dim LmdaPar() As Double
End Structure
Thanks in advance!!
Can ayone tell me how to pass an array of structures which contain arrays of
blittable types to unmanaged memory?
This syntax does not work:
Public Declare Sub SomeDll Lib "SomeDll.dll" ( ByRef MyStructure() as
SomeStructure, ByRef MyOutput as Int32)
I get junk on the dll side.
If I try to decorate the definition like this:
Public Declare Sub SomeDll Lib "SomeDll.dll" (
<MarshalAs.UnmanagedType,SafeArray>ByRef MyStructure() as SomeStructure,
ByRef MyOutput as Int32)
I get an exception the Type is not valid.
The structure has a definition similar to
<StructLayout(LayoutKind.Sequential, CharSet:=CharSet.Ansi, pack:=8)> Public
Structure SomeStructure
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=8)> Dim GasID() As Byte
Dim Mw As Double
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=4)> Dim CpPar() As Double '
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=2)> Dim MuPar() As Double
<MarshalAs(UnmanagedType.ByValArray, SizeConst:=3)> Dim LmdaPar() As Double
End Structure
Thanks in advance!!