Jump to content

Labview .Net interop assembly build then use in C#


Recommended Posts

I need help on the process of going from a built .net interop assembly DLL to using it in C#.

I have built a driver for our signal acquisition hardware in Labview. I can build a DLL using Labview, and then call this DLL in MS Visual Basic, C# and C++ in the 32 bit programming environment without problems. However, when I try to call the DLL from C#, under Win 7 x64, the C# application hangs while I am in debug mode. While in release mode the application runs fine. Some more sleuthing, and it turns out that Microsoft VS C# does not support debugging under x64 when using unmanaged DLL's. (Ones called using System.Runtime.InteropServices, and the DLLImport method). The solution appears to be use of a managed .net assembly instead.

Now, using Labview 2009 you can produce a .net interop assembly (Labview 2010 has a problem, and there is a CAR for it). First I created an object based wrapper for the existing VI code base by creating a Class with storage for each of the properties needed, and then writing the methods to read and write the properties, calling the existing vi codebase in the background where needed. I compiled this as a .net interop assembly. One concern is that I do not know what a 'Manifest' is, and could find no useful information on how to create one. (I'm thinking the manifest should use XML to list the class and the properties, and any help would be appreciated). So I didn't include one.

Now comes the other part of the equation - how to use it in MS Visual C# (I'm using 2010). This is where I got bogged down. I know how to include standard DLL's, but not the DLL produced by Labview 2009 as a .net interop assembly DLL. I've spent a lot of time searching to no avail.

I do know that an assenbly can be used either in the Global Application Store, or locally. I'm trying for local right now. My problem is nuts and bolts - what are the actual lines of code I have to write to use the assembly, and declare the properties and methods inside it to the C# program.

If anyone could help with a really simple example such as a class with one method X = A+B, build an interop assembly in LV 2009 for it, and then use it in a C# project to add two numbers and display the result would be fantastic.

Thanks very much - Bart

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.