Jump to content

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?

Link to comment
  • 2 weeks later...

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

Link to comment

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.

Link to comment
  • 8 years later...
On 3/30/2012 at 2:25 AM, Saverio said:

I posted an example here that you can take a look at.

hi , i tried your example code .but i am not getting the output. what  i made is i downloaded your example code and open the solution file with visual studio and run the the program i got the dial box and set the sine and amplitude and press the parameter set button . but i am not getting the output . i have the labView tool. to get the out put what are change required. or any running video can send to me it should be helpful. 

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.