I assume that you are using pInvoke to call C method in VB.NET
First of all, there is no default marshalling available for Jagged arrays which means that you will have to do your own custom marshalling which is a little complicated but not very difficult. Here is the code to do such a thing in C#. I am not that good with VB.NET Syntax so I am sure you would be able to convert this to VB.NET
[DllImport( "yourdll.dll", EntryPoint="YourMethodName", CallingConvention=CallingConvention.Cdecl)]
static extern void YouMethodName(IntPtr matrix);
static void Main( string[] args )
{
double[][] test_matrix = { new double[] {1.1,2.2},
new double[] {3.3,4.4},
new double[] {5.5,6.6}};
IntPtr pa1 = marshalJaggedArray( test_matrix );
YourMethodName( pa1 );
}
static private IntPtr marshalJaggedArray( double[][] array )
{
int sizeofPtr = Marshal.SizeOf( typeof( IntPtr ) );
int sizeofDouble = Marshal.SizeOf( typeof( double ) );
IntPtr p1 = Marshal.AllocCoTaskMem( array.Length * sizeofPtr );
for ( int i = 0 ; i < array.Length ; i++ )
{
IntPtr v1 = Marshal.AllocCoTaskMem( array[i].Length * sizeofDouble );
Marshal.Copy( array[i], 0, v1, array[i].Length );
Marshal.WriteIntPtr( p1, i * sizeofPtr, v1 );
}
return p1;
}
Taken from : http://social.msdn.microsoft.com/Forums/is/csharplanguage/thread/dd729947-f634-44f4-8d91-11fcef97cabe