LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DLL and pointers, messy stuff i don't understand---

Hi! I am a newcomer in calling DLLs from LAbview...

 

I am trying to implement FFTW (fastest fourier transform in the west) in LV. Though a windows DLL already exists,

I fear that it is quite impossible to work it directly under LV. Can you check me if this is correct?

 

this is what I would be supposed to do in C

 

1) Create a so-called "plan", specifying input and output addresses

       plan = make_plan(double *array_in, double *array_out)

 

2) Execute the plane

       fftw_execute(plan).

 

In C this makes the memory pointed by array_out being updated. In labview it does not... Therefore it seems that such a

programming-style is not supported by LV. Correct?

 

And, btway,  plz help me in understanding what's happening:

1a) I wire,e.g., a 1D array to a DLL (as *double); now, let's suppose, like in the aforementioned case, that the DLL does not do anything

on the array (neither read nor write), but simply "gets prepared" for doing something later. I can suppose that, somewhere in the memory,

it keeps tracks of the memory address of the data it has received.

 

2b) Another DLL call, that takes advantage of the information stored by the previous call, reads data in memory and perform calculations.

 

The questions are:

- If between 1 and 2 I change the value of the ARRAY in LV, the second call reads the proper (new) values?

- If not, what the hell happens to the pointer passed to the DLL in the step 1??? I mean, I LV REALLY PASSED THE DLL the memory address where data

are stored, I could effectively perform operations on them from everywhere in my operative system... but it seems that i CAN'T!!

 

Is there a place where I can find an in-depth documentation to such a stuff??

 

Thank you very muche,

 

 

michele

0 Kudos
Message 1 of 2
(2,606 Views)

The main issue you are running into is, that LV will make a copy of the array if you modify it under most circumstances and also make copies (actually 2) if you wire it to an indicator). So you will need to execute the fftw_execute dll call directly after the make_plan dll call and as inline code (so no SubVIs for each call). If you place a Sequence Structure around both dll calls (single frame), you can avoid that LV makes a copy of the array_out before the FFTW was performed (so place the indicator for the array_out outside the structure).

 

Felix 

0 Kudos
Message 2 of 2
(2,600 Views)