ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

call library function using array pointer

Hi,everybody.
Now I 'm using LV 8.0 to develop a  driver for my  DAQ.Right now I have the  Driver with APIs.So I intend to use the "CallLibralyFuncion" VI .BUt When I test it,the problem appears.
The first function I need to cal is "ScanDevice" function,with the details below:
Inputs:1.CardNumArray,a long type array for storing the returned card IDs,passed by pointer.
            2.CardNumArrayLength,tell the function the size of the array.
Return:The found Card count or error codes.
So I created the VI as show the file I given.
Then the problem appeared:There is always a application error :
It shown me some memory can't not be written.Is it mead I need pass a traditional pointer as in C ,Can the value of the control be used as a buffer to storing the return imformations?Or I need to do other work for calling this function.
Can anyone show me how to use "CallLibralyFuncion" to call my "ScanDevice" function?
0 Kudos
Message 1 of 4
(3,033 Views)

hi there

well, some wild guesses:

- is CardNumArrayLength the number of elements or the number of bytes? if number of bytes pass the number of elements multiplied by 4 to the dll
- try to use a constant U32 array as databuffer
- set the calling convention of the dll to "stdcall (WINAPI)"
- set the execution mode of the dll to "Runin UI thread"

please also post the dll here

 

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 2 of 4
(3,028 Views)
Nice help,sir,thanks a lot.
Actually I just forgot how to spell the word "elements" yestarday,It looks to be some not good :).
The dll file is hardware based and there is a kernel dirver too.So only dll file may show no effect.
Here is the file.
0 Kudos
Message 3 of 4
(3,012 Views)
Oh,my god,I have forgot to tell you that it works fine now.:)
So,thanks a lot again.
0 Kudos
Message 4 of 4
(3,007 Views)