LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how i create dll in c# for labview

hi i have c# language i want to create a dll to put inside labview.

i know that in c++ i just used
#include "extcode.h"
also "funtypes.h" was added to my project
a dll created in c++
i have added it and defined the inputs and outputs.
is there document or project example of dll created in c# that labview read.
0 Kudos
Message 1 of 7
(5,282 Views)
Michael,

I have included a link to a document entitled "Using External Code with LabVIEW". LabVIEW calling a dll is the same as any other language calling a dll. If you have a properly created dll, it should work in LabVIEW.

http://digital.ni.com/manuals.nsf/websearch/8D930295FFBF9F7686256D2C00624728?OpenDocument&node=132100_US

-Brett
0 Kudos
Message 2 of 7
(5,271 Views)
this document is alittle old and it is for visual studio 6

now there is visual studio 7
and csharp (c#) is diffrent

first i cant include files like in c++ i need to use namespaces, secondly i do not hav dllexport method

third thing i cant add lib

so what you suggest do you have example
0 Kudos
Message 3 of 7
(5,268 Views)
Is your code .Net based?
If so, I can give you some pointers since I recently had to integrate a c# dll via .net assembly.
~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 4 of 7
(5,258 Views)
yes my cod is .net based
do you have example
0 Kudos
Message 5 of 7
(5,246 Views)
Michael:

There are (2) .Net examples that ship with LV7.1, 'Simple Task Monitor" and 'Calculator' (use Help/Find Examples). They may be a good start, be sure to look at File/Vi Properties/Documentation for more info. Some pointers:

Requirements to use private .NET assemblies:
1) .NET Framework version 1.0 or greater must be installed on your system (get it from usoft)
2) Your private assembly (your dll)is in the same directory as your top level VI (Applies only if c# code is compiled as a private assembly (the default??), if compiled as a global assembly then see usoft KB 315682)
3) Your assembly has been added to .NET Assembly References using Tools >> Advanced >> .NET Assembly References...

You start with a Constructor node to point and link to your dll (right click on it to select constructor), then use properties, methods, and invokes from the .Net pallette of tools in LV. I have attached a LV7.1 vi that I used to prototype and test a C# dll that one of my coworkers had written to allow me to read and write to a database. Note that the code will not run since I have not included the dll and our database is not accessible outside our network. But hope it gives you a bigger picture to get going. I was very unfamilair with the properties and methods exposed in the dll, had to do a lot of playing around to see which ones were appropriate. If you right click on a property or method, you get a popup to show all available ones, pretty cool!
~~~~~~~~~~~~~~~~~~~~~~~~~~
"It’s the questions that drive us.”
~~~~~~~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 6 of 7
(5,232 Views)
michael bsc wrote:

> hi i have c# language i want to create a dll to put inside labview.
> i know that in c++ i just used<br>#include "extcode.h" also "funtypes.h"
> was added to my project, a dll created in c++.

You don't need these include files at all unless you want to call
LabVIEW manager functions as described in the External Code Reference
manual. Even if you would try to do that, it won't do much good as C#
is not directly compatible with standard C headers and link libraries.

> is there document or project example of dll created in c# that labview read.

As long as you create a real DLL you can import its functionality into
LabVIEW through the Call Library Node. C# DLLs are AFAIK not real DLLs
but really .Net assemblies and need to be imported in LabVIEW through
the .Net function nodes.

Rolf Kalbermatter
Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 7 of 7
(5,203 Views)