LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DLLs

I'm trying to write a simple Labview DLL that, when called, pops up a graph
window and plots the data supplied. The prototype in App Builder is

void PlotSingleGraph(float64 Data_X[], float64 Data_Y[], int32 numPoints)

where numPoints is the length input for both arrays. I'm calling it using
this code (WinNT, VisualC++ 6);

#include "stdafx.h"
#include "I:\Program Files\LabVIEW 6\cintools\extcode.h"
#include "I:\Program Files\LabVIEW 6\user.lib\Construction Yard\DLL
stuff\SingleGraphWindow.h"
#include

int main(int argc, char* argv[])
{
float64 x_array[10]={0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
float64 y_array[10]={0, 1, 4, 6, 16, 25, 36, 49, 56, 81};
int32 numPoints=10;


PlotSingleGraph(x_array, y_array, numPoints);

cout << x_array[5];

return 0;
}


No errors are reported, yet when the function is called the data is not
passed; the window opens, but the front panel array controls are empty and
the graph is blank. There seems to be nothing different in the "separate
array" example supplied on ni.com. Does anyone have any suggestions as to
what could be happening?

Incidentally, I explicitly include extcode.h and remove it from App
Builder's header file to simplify things, with files stored in different
places.

--
Craig Graham
Physicist/Labview Programmer
Lancaster University, UK
0 Kudos
Message 1 of 3
(2,305 Views)
Craig,

The first thing I can suggest is to NOT use float64. I would really recommend using fixed point to transfer data. I have had some bad experiences trying to use floating point.

I have a very complex LabVIEW dll that uses, in some cases, arrays to pass data in and out of the dll. We using only integers, and have no problems.

I would suggest downgrading your dll to integers, and go from there. Let us know how you do with this if you can't get beyond it.

I would also recommend starting a support inquiry with NI. They can answer some of the more detailed specifics of your question. I suspect, given the simplicity of the dll and code, that the problem is in fact with the float64 data type.

Good luck.
0 Kudos
Message 2 of 3
(2,304 Views)
"Labviewguru" wrote in message
news:5065000000050000006A590000-1007855737000@exchange.ni.com...
> Craig,
>
> The first thing I can suggest is to NOT use float64. I would really
> recommend using fixed point to transfer data. I have had some bad
> experiences trying to use floating point.
>
> I have a very complex LabVIEW dll that uses, in some cases, arrays to
> pass data in and out of the dll. We using only integers, and have no
> problems.

Hmm. How do you mean "fixed point"? Are you saying you just multiply all
your values by a "fudge factor" appropriate to the size of the number, then
cast it to an I32 and pass it to Labview, where you then divide by the fudge
factor and cast it back? It's the kind of bodge that could really come back

to haunt me if used in a generic data plotting DLL and I re-use it down the
line 🙂

I guess I could pass the fudge factor to the DLL as well to make the
function more general, but hopefully bringing it up with NI will help with
passing the arrays as float64s. Another option I might try is passing single
precision rather than double, which for data plotting won't make a great
deal of difference and may avoid any problems specifically related to
float64s.

--
Craig Graham
Physicist/Labview Programmer
Lancaster University, UK
0 Kudos
Message 3 of 3
(2,304 Views)