MathGroup Archive 2006

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

Search the Archive

NetLink with float* as argument

  • To: mathgroup at smc.vnet.net
  • Subject: [mg71800] NetLink with float* as argument
  • From: lamoucheg at gmail.com
  • Date: Wed, 29 Nov 2006 02:56:50 -0500 (EST)
  • Organization: CNRC-NRC

Hi,
   my collegue wrote a dll (written in C++)  to provide tools to read
a custom data file format.

With NETLink I can use most of his functions (opening  a file, closing
a file, reading some simple specific data), but I have trouble with
the following.

He has a function like:

 long ReadPatch	(float *Buf,long PosX, long PosY, long SizeX, long
SizeY, long Channel);

It waits for a Buf pointer with space allocated for an array of float,
reads the data in a file and put it where Buf points to. To be
precise, the array in fact does not need to be initialized, but space
must be reserved.

After reading the documentation in the help file, my naive attempt at
using the function is:

readPatch = 
  DefineDLLFunction["ReadPatch", 
    "TheNeeded.dll", 
    "long", {"float*", "long", "long", "long", "long", "long"}]

Then, I define:
AA = Table[0., {5}, {5}]

to reserve space.

Then when I try the followint, hoping that AA upon return contains the
read data,

readPatch[AA, 0, 0, 5, 5, 0]

I get the message
NET::methodargs: Improper arguments supplied for method named
readPatch.

I tried various things, looked around and cannot figure out how
achieve what I want. Is it related to the fact that I need a pointer
to a float array and that internally AA is an array of double?

Note that I don't have any doubt about the efficiency of my
colleague's DLL, since it works perfectly whenused with Labview.

Thanks in advance for any input.

Guy Lamouche


  • Prev by Date: Re: Using subscripts in function-parameter names
  • Next by Date: Re: Unexpected warning with ArcTan
  • Previous by thread: SubValues
  • Next by thread: Re: NetLink with float* as argument