Try this. Sorry, not much commenting.
#include <cvidotnet.h>
#include "vbMath.h"
#include <cvirte.h>
static CDotNetHandle exceptionHandle;
static vbMathDLL_mathClass classHandle;
void init()
{
double * result;
double *myArray;
int i,p;
Initialize_vbMathDLL();
vbMathDLL_mathClass__Create (&classHandle, &exceptionHandle);
result=CDotNetAllocateMemory(sizeof(double));
myArray = CDotNetAllocateMemory(sizeof(double)*5*5);
for(i=0;i<5;i++)
for(p=0;p<5;p++)
{
*myArray = p;
myArray = myArray +1;
}
myArray=myArray-25;
vbMathDLL_mathClass_addArray (classHandle, myArray, 5, 5, 5, 5, result, exceptionHandle);
CDotNetDiscardHandle(classHandle);
CDotNetDiscardHandle(exceptionHandle);
Close_vbMathDLL();
}
int main (int argc, char *argv[])
{
if (InitCVIRTE (0, argv, 0) == 0)
return -1; /* out of memory */
init();
return 0;
}
----------------------
Imports System.Reflection
Public Class mathClass
Dim globalVal As Double
Public Sub addArray(ByVal array(,) As Double, ByVal x As Integer, ByVal y As Integer, ByRef c As Double)
Dim i As Integer
Dim p As Integer
c = 0
For i = 0 To x - 1
For p = 0 To y - 1
c = c + array(i, p)
Next
Next
End Sub
End Class
Message Edited by craige on 09-01-2009 10:16 AM