LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling LabVIEW-generated .Net Interop Assemble from C

My LabVIEW-generated .net interop Assembly has a single class with a single method: return type is void, and the only parameter is a string array.  I notice that the method is declared as 'static' (I'm don't know how to make this non-static).  I am assuming I don't create an instance of the class, but just call the static method using the class name.  Bottom line is that I can make the call (I've referenced the dll and use the correct namespace), but the class doesn't run (there are no errors reported).

Some more detail: LabVIEW generates the .net assembly based on a single vi.  This vi contains a Netstream Reader End Point.  I have a Netstream Writer End Point on another computer.  Both end points have to be launched before either will execute.  I have the Writer End Point launched on the second computer.  If I use the vi Reader End Point within LabVIEW, it works (i.e. the writer sends data to the reader).

In simple terms, I need to know how to wake up the LabVIEW-generated .net assembly.

Thank you

0 Kudos
Message 1 of 3
(2,484 Views)

Sorry but this description sounds pretty convoluted.

 

Are you saying that you use in LabVIEW the .Net nodes to write a VI that then gets compiled into a .Net assembly to be called from C# (I assume the C is a typo, calling .Net assemblies from standard C is definitely not a Microsoft santioned way, although you can make it work with lots and lots of trouble as C is close enough to assembly coding that you can do almost anything in it if you are willing to make the effort).

 

If above is right then that sounds to me like a VERY roundabout way to call .Net functionality in your code. Why the LabVIEW .Net assembly in between at all?

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 3
(2,449 Views)

You're right, I meant C# and not C.  I'm taking a convoluted approach because I have a legacy program in LabVIEW on one computer (call it A) and an application I'm writing in C# on a second computer (call it B).  I choose to use a Network Stream to transfer data from the A to B.  To test communications, I mocked a Stream Writer in LabVIEW on A, and a Stream Reader in LabVIEW on B.  It worked.  The missing bit was to replace the LabVIEW on B with an equivalent Stream Reader in C#.  I was not able to do this.  So, I am faced with calling the LabVIEW on B from C#.  Turns out I can compile the LabVIEW on B into a .NET Interop Assembly (I'll call this X).  I then reference X from within my C# application.  After adding a appropriate "using namespace", I'm able to make calls (I have a single method that returns a string array).  Problem is -- my string array remains null.  BTW - the array has only 10 strings and only needs to be sent about once per second.

I agree with you -- I don't like the approach I'm taking -- but I'm stuck coming up with anything more direct that works.  Although this is a small part of the application I'm working on, it's an essential part - I may need to hire someone to provide the solution.  I intend to make heavy use of LabVIEW, but (right now) I don't have to experience to make the right choices.

0 Kudos
Message 3 of 3
(2,439 Views)