Measurement Studio for VC++

Showing results for 
Search instead for 
Did you mean: 

Calling labview dll from C

Calling labview dll from C

I`m having problem with one DLL file generated by labview. I got dll file, with .h file and .lib file, but I actually dont know how to call function from labview dll file.


Here is structure of functions, and code I tried to call.



TD1 *xRefPtr = new TD1;
TD1 *yRefPtr = new TD1;
TD7 *xPointsPtr = new TD7;
TD7 *yInterpolationPtr = new TD7;


TD1Hdl xRef = &xRefPtr;
TD1Hdl yRef = &yRefPtr;
TD7Hdl xPoints = &xPointsPtr;
int32_t Type;
TD7Hdl yInterpolation = &yInterpolationPtr;


(*xRef)->dimSize = 1;
(*xRef)->elt[0] = 1.185739365;


(*yRef)->dimSize = 1;

(*yRef)->elt[0] = 0.137887336;


(*xPoints)->dimSize = 1;

(*xPoints)->YValue[0] = 1.195739365;


//Should I do something with yInterpolation?????

//(*yInterpolation)->dimSize = 1;
//(*yInterpolation)->YValue[0] = 102545.11;


CalcInterpolation2D(&xRef, &yRef, &xPoints, 3, &yInterpolation);





And function CalcInterpolation2D is declared as: 

CalcInterpolation2D(TD1Hdl *xRef, TD1Hdl *yRef,
TD7Hdl *xPoints, int32_t Type, TD7Hdl *yInterpolation);

0 Kudos
Message 1 of 4

Re: Calling labview dll from C

Hi Raaj,


- which LabVIEW version did you use to make the DLL?

- from which environment are you trying to access the DLL?

- what problem do you get from your current code? Which error messages?

- what are your TD1, TD7 and TD1Hdl and TD7Hdl datatypes? How are they defined?




0 Kudos
Message 2 of 4

Re: Calling labview dll from C

Hello Joseph,


Thx for the reply.


- I am not sure which version was used. I was given only the header file and the dll. But I guess dll was made using the LabView 2011.

- I am trying to access the dll from the VC++ environment

- I would like to know the definition of the function and definition of the parameters in the function, which is present in the header file of the dll.

TD1, TD7 and TD1Hdl and TD7Hdl datatypes are defined using the labview environment. 


For example, 


typedef struct {
int32_t dimSize;
double elt[1];
} TD1;
typedef TD1 **TD1Hdl;


Plz lemme knw if I have to give more info.


It will be helpful for me if you please tell me whether I can use any utility tools in order to see the definition of the function and it's parameters in the header file. (I heard abt DEPENDENCY WALKER). 

0 Kudos
Message 3 of 4

Re: Calling labview dll from C

Hi Raaj,


I cannot tell you much about the meaning of the different parameters since that depends on what was programmed.


In order to use a DLL created with LabVIEW you need to make sure the LabVIEW run-time engine for the relevant LabVIEW version is installed.

It is important that the run-time engine is installed in the same version as the LabVIEW version used to create the DLL so you need to find that out from the developer of the DLL.


I take it that the datatype in LabVIEW is a cluster, which is what naturally maps to a struct in C, but I cannot say any more than that.

What problem are you having when trying to use functions from the DLL? Do they return an error? Does the program compile at all? I don't yet undestand what your question is.




0 Kudos
Message 4 of 4