Jump to content
caleyjag

Calling dlls made in LabVIEW 2011 in Visual C# .NET 4.0?

Recommended Posts

Hi all,

I've been trying to figure out how to get a function made with LabVIEW 2011 up and running in MS Visual C# 2010 (.NET 4.0)

I've been using this guide:

http://zone.ni.com/reference/en-XX/help/371361H-01/lvhowto/building_a_net_assembly/

When i try to execute the code I made in visual studio I get the following error:

Failed to call InitLVClient function

I've seen this thread:

http://forums.ni.com/t5/LabVIEW/VIAssemblyException-quot-Failed-to-call-InitLVClient-function/td-p/1472988

My question to you is, is it possible to create LabVIEW 2011 code for use in Visual C# 2010?

If so does anybody have a link to a guide on how to export LabVIEW 2011 VIs into a format that can be called from Visual C# 2010? Even better yet, does anybody have any example code I could work off?

Share this post


Link to post
Share on other sites

http://zone.ni.com/r...a_net_assembly/

Calling the .NET Interop Assembly from Another Program

After you build a .NET interop assembly, you can call the assembly from other programs that support .NET. However, ensure that the computer on which the other program runs meets the following requirements and recommendations:

  • The LabVIEW Run-Time Engine must be installed on any computer on which users run the .NET interop assembly. You can distribute the LabVIEW Run-Time Engine with the .NET interop assembly. (Windows) You also can include the LabVIEW Run-Time Engine in an installer.
  • National Instruments recommends that the target computer for the .NET interop assembly have the same or later version of the .NET Framework installed as the version that LabVIEW used to build the application.
  • To call the .NET interop assembly outside of the LabVIEW development environment, you must referenceNationalInstruments.LabVIEW.Interop.dll in the Microsoft Visual Studio project. The LabVIEW Run-Time Engine automatically installs this DLL to the National Instruments\Shared\LabVIEW Run-Time directory.

------------------------------------------------------------------------------------------------------------------------------------------------------

I built (interop assembly) a virtual keyboard in LV2011 64bit and a coworker is able to successfully call it from both C# and C++. I had the LabVIEW.exe.config set to <supportedRuntime version="v4.0.30319"/>. My coworker had to specifically target 64bit processor (instead of 'Any Processor') in C#. This seemed to have something to do with witch LV Runtime engine was called (32 vs 64)

Good luck

Denis

Share this post


Link to post
Share on other sites

I was having exactly the same problem, and was told that LabVIEW 2011 does not compile for the 4.0 framework. Try targeting your C# project for .NET 3.5. That's what I did, and it works just fine.

OOPS, my bad. The LV2011 32-bit does not compile to ver 4.0.

Share this post


Link to post
Share on other sites

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.