MathGroup Archive 2004

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

Search the Archive

Net/Link: Problem with DLL (1)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48855] Net/Link: Problem with DLL (1)
  • From: "psa" <psa at laplacian.co.uk>
  • Date: Sat, 19 Jun 2004 04:31:03 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

My C type DLL (written in Compaq Visual Fortran)  returns a length 2 double
array, and I cannot get all two of the results.
I am confused as to when and how to supply an object in .Net/Link. I tried:

 In[] =
TestDLL2=DefineDLLFunction["testDLL2","maths0000.dll","Void",{"Double","Doub
le","Double","Double","out Double[]"}];

With what I believe is the required and it fails.

In[] =  res=MakeNETObject[{0.0,0.0}]
 «NETObject[System.Double[]]»
In[] = TestDLL2 [1,2,3,4,res]
 NET::netexcptn: A .NET exception occurred: System.NullReferenceException:
Object reference not set to an instance of an
obj.espace.DLLWrapper8.testDLL2(Double , Double , Double , Double ,
Double[]& ).
 $Failed

Ditto, if it is it is passed res={0.0,0.0}.

By pretending it is just a scalar for output array I get the first element
only (not surprisingly?)
In =
TestDLL2=DefineDLLFunction["testDLL2","maths0000.dll","Void",{"Double","Doub
le","Double","Double","out Double"}];
In[] = TestDLL2 [1,2,3,4,res]
In[] = res
 -0.0229672

If I am NOT doing something wrong, Is there a Windows API that returns an
array so I can see it working?

Thanks

Peter Aptaker




  • Prev by Date: Re: General question on handling very large datasets in Mathematica
  • Next by Date: Re: Integration error in 5.0?
  • Previous by thread: AW: Simplifying a large matrix into an equation using M
  • Next by thread: Re: Net/Link: Problem with DLL (1)