LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DLL file creation

Hi,

I have a doubt regarding DLL file creation in LabVIEW using strings as inputs and output. I am performing a simple operation of input strings concatenation. I have tried with the following settings in the "Define Prototype" :

1. String handle pointer

2. C string pointer

3. Pascal string pointer

 

I have tried with the both the calling conventions "Standard" and "C".

 

When I use the "Call Library Function Node", I am getting the following error :

Code : 1097

 

I have attached the following :

1. A png file named "Code snippet.png"

2. "Test DLL.zip" contains the following :

i. "Add" and "Concatenate" are the base VIs.

ii. "Calling add DLL" and "Calling concatenate DLL" are the call library function VIs.

iii. The "Add" DLL is working perfectly fine.

But, the "Concatenate" DLL is not working.

 

Thanks in advance for your time.

Download All
0 Kudos
Message 1 of 7
(2,987 Views)

When opening your project, the build script doesn't have any VIs as source. Probably removed because the paths are not relative or something. This is where everything fails...

 

The Add.vi has a cluster input, so when calling it, you should wire a cluster. Or give it two numeric inputs and call it with two numeric inputs.

 

The string function can't\won't return a string in the return value. The return value is a I32, and a pointer to a string isn't how LabVIEW handles strings. This would require the caller VI to release the memory at some point. So you have to provide an input for the output... I'll go for String handles (pointers), as that is what LV uses. If you go for C strings, LV needs to know the length of the output upfront.

Message 2 of 7
(2,961 Views)

Hi wiebe,

 

Thanks for the reply.

 

I have been unable to read the strings and output the concatenated string as output even with the "String Handle Pointer" as the pass by type. Also, the "Add" functionality with the numeric is working fine. But, the "Concatenate" functionality with strings is not working fine.

 

I have attached the code with correct path linking.

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

You're not calling the concatenate properly.

 

You've configured the it to return the string in the return value, not in the first input.

 

So you have return value = Concatenate (output, input, input), but you call it as return value = Concatenate (input, input).

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

Hi wiebe, 

Even with the return type as "String handle pointer", it doesn't work. Have you tried it before?

0 Kudos
Message 5 of 7
(2,923 Views)

Do not use the return type!

 

The dll isn't created with a string handle pointer return type.

 

The returned string is the first input of the dll. It has 3 inputs, the return string, and two input strings. The return value isn't used.

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

I can't recompile your code (I don't have an activated application builder license in 17).

 

When I configure the dll with three input strings configured as string handle pointer, I do get the correct result, but LV crashes... Do you get this?

 

I'd try to configure the dll as (string handle pointer, string handle, string handle), although I think it should work as it is.

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