I have a general purpose C DLL, with functions to return pointer to a double array.
I have been able to use it in Perl and C# (Return C++ array to C#) as per my requirement.
How do I use the array (double) being returned by the DLL in VB.NET?
I have a general purpose C DLL, with functions to return pointer to a double array.
I have been able to use it in Perl and C# (Return C++ array to C#) as per my requirement.
How do I use the array (double) being returned by the DLL in VB.NET?
 
    
    As suggested by @Heinzi:
Imports System.Runtime.InteropServices
Declare Function functionReturnsArrayPointer Lib "cLibrary.dll" _
        (ByVal argument1 As Double, ByVal argument2 As Integer) As IntPtr
Sub Main()
    Dim arrayWithResult As Double() = New Double(2) {}
    Dim pointerToArray As IntPtr = functionReturnsArrayPointer(12.345, 6)
    Marshal.Copy(pointerToArray, arrayWithResult, 0, 2)
    ' Can also be done as:
    ' Marshal.Copy(functionReturnsArrayPointer(12.345, 6), arrayWithResult, 0, 2)
    ' Do whatever with array
End Sub
