MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

NET/Link return array from C++


I am having some problems returning an array back from C++.

I would expect {100.,100.,100} coming back in my example.
Can anyone explain what I do wrong?

C++
void Test123(double x[], int size, double* result)
{
      for (long i = 0 ; i < size; i ++)
		*(result+i) = 100.;
}

NoteBook

In[1]:= Needs["NETLink`"];
TEST123 = DefineDLLFunction["ErrorFunctionA","mydll.dll",
"Void",{"double[]", "long", "out double"}];

input1=MakeNETObject[{1., 2., 3.}];
res=MakeNETObject[{0.0,0.0, 0.0}];

TEST123[input1, 3, res]

NETObjectToExpression[res]

100

Regards
Lars Schouw


  • Prev by Date: Re: Partition(divid string to substring
  • Next by Date: Re: Help with output form?
  • Previous by thread: Re: Re: "Mathematica in Education and Research"
  • Next by thread: Re: NET/Link return array from C++