10-12-2011 08:10 AM
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.
Solved! Go to Solution.
10-12-2011 08:14 AM
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.
10-12-2011 04:03 PM
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.
10-12-2011 04:07 PM
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
10-13-2011 02:13 AM
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.
10-13-2011 08:04 AM
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.
10-17-2011 05:43 AM
thanks all,
I am now able to pass arrays from LabView to Prode Properties and vice versa.