LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling a LabVIEW DLL with parameters of type Cluster containing a String

I have been trying for the past couple of days to figure out how to do the following:

 

  • From a Visual C++ 2010 C++ program to call a LabVIEW 2011 DLL which returns a parameter of type Cluster, where the cluster contains a String member.

 

I have been successful in getting back a regular C String from the LabVIEW DLL, I have been successful in getting back a Cluster containing a regular integer, but once I change it into a String and use the LStrHandle type, I get a weird memory dump file with no stack trace or any indication of what went wrong.

 

It almost feels as if LabVIEW specifically disables this functionality, i.e. does not want me to call into a DLL which uses a Cluster with a parameter of type Cluster with String.

 

I tried allocating the LStrHandle type by using labview.lib, but once I try calling the LabVIEW generated DLL, I get an error message stating that "LabVIEW.lib called from a non LabVIEW process".

 

I then get a memory dump file named "01e72e4a-d727-4245-bf2a-a2fc63975837.zip"

 

Anybody have success calling a LabVIEW DLL in such as way?

 

 

 

0 Kudos
Message 1 of 3
(2,256 Views)

It's been a very long time, but I seem to remember problems transfering strings in and out of LV in this way. As I recall LV passes a handle to what used to a counted string where the first byte is the number of bytes in the string. Does your code work if the parameter being passed is an array of U8s? If so that could be an easy solution. Just pass an array where you have appended one element containing 0 to the end of the array. In the C world that would look an awful lot like a null-terminated string.

 

Mike...


Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 3
(2,251 Views)

I doubt anyone will be able to do anything useful with the dump file; could you instead attach your VI and the C++ function that calls it?

 

One thing I would try is writing a small LabVIEW program that calls the DLL (yes, you'll have a LabVIEW VI calling a DLL built from a VI).  Make sure that works, then right-click the call library function node and choose "Create .c file..."  This will give you a C stub demonstrating how to call the VI inside the DLL with the appropriate data types.

Message 3 of 3
(2,238 Views)