LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

I recieve an end-of file error when trying to call a static method from a .NET assembly

Hi

I'm trying to call a static method from a .NET assembly provided for a Pololu micro maestro servo controller. Pololu provide the pre-compiled .NET dll as part of their SDK at http://www.pololu.com/docs/0J41.

I am certain that this method can work, as when I build and run the supplied C# project in the SDK, which uses the same dll, it works fine, and my servo controller can be written to.

What I tried was:

  1. I placed a .NET invoke node on the bloke diagram
  2. I right clicked on it to get the select class menu, picked .NET, and then browse...
  3. selected the usc.dll provided in the pololu SDK
  4. picked the static method getConnectedDevices()

And I get the error pictured. I have essentially no idea what this means really, can anyone offer any advice?

 

Josh

0 Kudos
Message 1 of 9
(3,159 Views)

Does the .NET class include a constructor?  You may need to instantiate an instance of the .NET class, using a constructor, before calling a method on it.

0 Kudos
Message 2 of 9
(3,152 Views)

For static methods you do not create a constructor, since a static method is tied to the class, not the object, which is what a constructor gives you. So, the steps that Josh is following are the correct ones. As to the issue: You did not indicate what version of .NET was used to create the assemby, or what version of LabVIEW you are using. Is it .NET 4.0? If so, be aware that no shipping version of LabVIEW "officially" supports .NET 4. It may work, it may not. However, a number of people have had problem accessing private assemblies written in .NET 4.

0 Kudos
Message 3 of 9
(3,149 Views)

Of course, I should have given that information to start with, sorry!

 

I'm running LabVIEW 2011 SP1 on Windows XP x64 (also on another x86 machine). The readme in the SDK says

 

All the source code and precompiled binaries here target .NET Framework
3.5, but they should work with later versions of the framework.

So I don't think it's a version problem...

0 Kudos
Message 4 of 9
(3,145 Views)

Ah, right, missed that key word "static" in the post...

0 Kudos
Message 5 of 9
(3,141 Views)

Are you running 32-bit or 64-bit LabVIEW? Does the assembly match the bitness?

0 Kudos
Message 6 of 9
(3,136 Views)

I have 32-bit LabVIEW on both x86 and x64 machines.

The assembly is also 32-bit, so yes, they should match.

0 Kudos
Message 7 of 9
(3,126 Views)

Although, as an update, I've tried again on the x86 machine and I don't see this error. I'm not sure where that leaves us really. The assembly should still work on x64 as far as I can see, since it functions via Visual Studio C#...

0 Kudos
Message 8 of 9
(3,125 Views)

Not sure. The only other guess I have is that the assembly was compiled using "Any CPU" rather than x86. Such an assembly would run as 64-bit on a 64-bit platform, but croak when it tries to load a dependent assembly which is 32-bit.

0 Kudos
Message 9 of 9
(3,108 Views)