LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a LabVIEW Shared DLL for use with C# and Strings?

Hi All,

I am trying to create a prototype for a LabVIEW Shared DLL that all the VI does is take in a string and return an upper cased string. Needless to say the DLL builds fine but when I try calling the shared DLL from C# the .NET application recieves an exception about "Ansi char arrays can not be marshaled as byref or as an unmanaged-to-managed parameter". Does anyone have an example of how to pass a string to a VI and return a string or an example of a better way of accomplishing this.

We are using labVIEW 7.1 on Windows 2000.

I am in quite a bit of a hurry to prove that this type of a LabVIEW Shared DLL VI would work. The eventual system will be passing in a string of XML with a large amount of
data and returning XML.

Thanks in advance,

Jim
0 Kudos
Message 1 of 2
(3,148 Views)
Hello jprucha,

This occurs because LabVIEW DLLs are not considered managed code. As such, we need to define the C# function as unsafe to be able to call unmanaged DLLs.

You can find more information about C# and managed code at Microsoft's developer website linked below.

MSDN Home Page

Good luck with the development,

Matt F
0 Kudos
Message 2 of 2
(3,148 Views)