LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Prode Properties

Solved!
Go to solution

Has someone experience in accessing a generic Windows DLL from LabView ?

I wish to use Prode Properties (see "prode.com") for calculating the thermodynamic properties required by a control system based on LabView , I am able to access the dll from C, C++, Visual Basic , Fortran and I think it should be easy to link with LabView... may be with a little custom interface (not sure).

Comments and suggestions are welcome.

0 Kudos
Message 1 of 7
(2,714 Views)

I'm sorry for being so blunt, but have you bothered to check the LabVIEW manual? Apparently not, since there's a whole chapter in there on accessing third party code from LabVIEW. There's even a full-blown example that ships with LabVIEW on calling DLLs.

0 Kudos
Message 2 of 7
(2,711 Views)

thank you for the comment,

yes, I have read the Labview manual and I have created a limited framework which permits to call methods (in external dll) ,  my question is about calling methods with complex data exchange, for example passing pointers to ANSI C vectors of doubles and similar stuff, I do not remember much information about this. 

0 Kudos
Message 3 of 7
(2,694 Views)

You should ask specific questions, otherwise it's hard to help.

 

As smercurio said, there are many examples, including how to pass arrays etc. here C:\Program Files\National Instruments\LabVIEW xxx\examples\dll\data passing

0 Kudos
Message 4 of 7
(2,690 Views)

thanks for the comments,
my question is related to passing array's from labview to external dll.
Specifically I have in external dll several methods which require these parameters
Here I include a simple example of the method BPLine() in ppp.dll with access from VBA and C/C++

// C declaration

__declspec(dllexport) int WINAPI BPLine(int,double*,double*,int);

// example of access from C

int stream, nrpt;
double bpt[50];
double bpp[50];
stream = 1;
nrpt = BPLine(stream,bpt,bpp,50);


// VBA declaration

Public Declare Function BPLine Lib "ppp.dll" (ByVal str As Long, ByRef pt1 As Double, ByRef pp1 As Double, ByVal max As Long) As Long


' example of access from VBA

Dim stream As Long, nrpt As Long
Dim bpt(0 To 50) As Double
Dim bpp(0 To 50) As Double
stream = 1
nrpt = BPLine(stream,bpt(0),bpp(0),50)



In this forum I have found several messages discussing the topic, see for example

http://forums.ni.com/t5/LabVIEW/Error-1097-when-passing-array-from-C-DLL-to-LabView/td-p/607820

which however mention a document now removed.
My goal being to access the above mentioned methods from Labview. in a simple way.

Suggestions and comments very appreciated.

0 Kudos
Message 5 of 7
(2,670 Views)
Solution
Accepted by topic author marsant
  1. Open the Example Finder.
  2. Change to the Search tab.
  3. Enter "DLL" in the search tab.
  4. Open the example called "Call DLL'.
  5. Run the VI.
  6. Scroll down the multicolumn listbox on the front panel to the row that says "1-D Array".
  7. Click on the "Open Example VI for Current Data Type".

That shows you how to call a function that takes in an array. Just like the text code you need to allocate the array in LabVIEW first, since that's what the DLL expects.

0 Kudos
Message 6 of 7
(2,653 Views)

thanks all,

I am now able to pass arrays from LabView to Prode Properties and vice versa.

0 Kudos
Message 7 of 7
(2,632 Views)