MathGroup Archive 2005

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

Search the Archive

NET/Link return array from C++

  • To: mathgroup at smc.vnet.net
  • Subject: [mg60978] NET/Link return array from C++
  • From: "Lars Schouw" <schouwla at yahoo.com>
  • Date: Thu, 6 Oct 2005 04:08:20 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

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++