LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

a problem with dll

i need labview to call a dll which i made by VB, and i am able to output numeric by using Call Library Function Node, but still have some problem when outputing a string, everytime labview crashes.
Now i simplify my dll as follow
 
public function add(byref c as string) as string
c="d"+"sfg"
end function
 
simple as you see
 
choosing the dll path, the function name "add" and stdcall, setting parameter as "CStr add(CStr c)" ,however, every time it crashesSmiley Sad
 
Any suggestion will be appreciated.
thank you
0 Kudos
Message 1 of 2
(1,611 Views)
Try this:

The call library function node has two columns of terminals. The one on the left are inputs the one on the right are outputs. When you have a string output you wire to the right side terminal. Try generating a string of spaces, nulls or whatever that is larger than the output string you will be betting back from the DLL and wire it to the left side (input) terminal opposite the string output. This has the effect of preallocating memory for the output string.

Also try this:

Rather that trying to define the output as a string, define it in the call library function node setup as an array of U8s. Do the same preallocation as above but with an array. Naturally the output will now be an array but there is a built-in function that converts an array U8s to a string.

Hope this helps...

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 2
(1,596 Views)