LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

C#: is there an example which shows how labview built dlls can be called in C#

I am running into problems when I try to DllImport a labview built dll in C#. Is there any example code I can be provided with showing such an application?
0 Kudos
Message 1 of 5
(2,761 Views)
What kind of problems are you running into? Make sure that you double check the C signature in the generated .h file. I've seen people run into problems with the cdecl vs. stdcall issue.

Example-wise, any Dllimport example will work because from the outside, the DLL looks like a C DLL.

Also, where is your C# code running? For example, there are issues with ASP.NET and LV DLLs (see my blog for details).
0 Kudos
Message 2 of 5
(2,757 Views)
I used stdcall and the C signature in the header file looks ok too. I am just creating a generic console application to port a labview example to C#. For some reason, although the DLL and the entry point get recognized, it doesn't execute the function and exits execution when the dll is invoked.

any ideas why..? :s
0 Kudos
Message 3 of 5
(2,752 Views)
Not in something as simple as that. I would first try to do the simple "Add" method. Make a VI that just adds two numbers together and then use the AppBuilder to make that into a DLL. The reason I suggest that is it removes all sorts of issues about subVIs, UIs, data files, etc. that a full blown LV Example might have. It also makes it easier for you to post the various pieces for me if you can't get it working.
0 Kudos
Message 4 of 5
(2,727 Views)
I seem to have it working now. It was a waveform data type - array conversion that was going wrong. Thanks for the help
0 Kudos
Message 5 of 5
(2,724 Views)