How to use a C# dll in Labview?

How can I use a C# dll in Labview 8.2? With the "Import Shared Library" Wizzard I need the header file which I don't have. Is there another way
to use such .dll to import the functions created in C#?
Thanks in advance
                              Norick

Norick,
afaik there is no tool which provides you the possibility to create something like an instrument driver for .NET assemblies.
Maybe we should take a look into terminology:
- Instrument driver: This is a set of functionality, which provides the user with an easy to use API for a special instrument. Very often, the driver itself is written in C/C++ and provided as a DLL.
- "Import Shared Library" Wizard: This wizard enables the user to create an own API for any C/C++ DLL (or compatible) for LabVIEW. This wizard requires the information on all exported functions; this info is contained in the header file. The result of the wizard is a set of VIs containing one Call Library Function Node each for each exported function.
- .NET assembly (extension .exe OR .dll): This can be compared to ActiveX. So the way to program with .NET is similar to ActiveX. Maybe you want to take a look into the examples of LabVIEW regarding .NET...
- Global Assembly Cache (GAC): All assemblies contained here are registered in the system. Every application can easily work with assemblies contained here.
- Private assemblies: This would be the way to work with .NET assemblies which are built on your own. You have to select the .DLL-file itself and make sure that the file can always be found in the same (relative)folder of your application.
hope this helps,
NorbertMessage Edited by Norbert B on 02-21-2007 02:16 AM
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.

Similar Messages

  • How to use matlab compiled DLL in Labview ?

    I have LV 8.5, and am unable to use a matlab compiled DLL in my LV code. I have tried the 'import'  command, but it does not list any functions. However, it does not show any errors during its execution. The existing solutions/responses to this question do not work either. I would also like to know of a way to deal with mxArray datatype. What is its equivalent in C (or any other high-level language) ? How do I retrieve an array that is returned from the matlab dll ?

    I'm assuming you have either Matlab installed or at the very least the Matlab Runtime, otherwise the DLL won't work. The "import" command relies on having a header file. Do you have one? You also need to make sure the DLL has been compiled so that it's compatible with LabVIEW. The most likely problem is name mangling, which also occurs when you try to compile a DLL written in C++. See this post, which contains links to useful posts.
    The mxArray datatype is a special datatype which is actually a structure. It's complicated. Your best bet is to create a C DLL that acts as an intermediary between the Matlab DLL and LabVIEW. If you are able to, you can, instead, simply call the Matlab code directly using the Matlab script node.

  • How to use third party DLL's in LabVIEW

    Hi all,
    Am using maxon EPOS 2 (Easy Positionning system) to control the EC motor. It comes with the 32-Bit Windows DLL for labVIEW. How to use these library unctions in labVIEW properly? When i try to call those library function in a LabVIEW program, it's showing me that one warning affecting one caller and so the subVI is not executable. Do i have to change the location of the library files or make to make any other changes??  
    Solved!
    Go to Solution.

    Have you seen the KB: Program a Maxon EPOS Controler using LabVIEW ?
    Christian

  • Using gpib-32.dll in Labview 7.0

    Hi there,
    I am relatively new to Labview and I need some help trying to program an old HP3488A switch/control unit using the Call Library Function Node. I would like to convert the existing VB6 code, which uses gpib-32.dll, into Labview. What I have done in the VB code is to call the ibdev function to set up the HP instrument. I would like to do the same in Labview. How would I even go about setting up the .dll files as I am revamping the existing code (running on a Pentium II computer) and trying to create an identical code in Labview (running on a Pentium III computer). Also, after I have set up the .dll files (done any system configurations if necessary), how do I actually implement this file in Labview?
    I have tried calling the ibdev function in the properties of the Call Library Function. I created 6 parameters of return types with ranges of type long. Then I pass integers into the input of this node and when I tried running it I get an error exception within the external code as follows:
    "An exception occured within the external code called by a Call Library Node. This might have corrupted Labview's memory. Save any work to a new location and restart Labview. VI "switch.vi" was stopped at Call Library Function Node 0x1D7C of subVI "switch.vi"
    Can someone please help me? Thanks.

    I actually tried that before. As the HP3488A switch instrument is very old and came out before IEEE488.2 got introduced, it still uses IEEE 488.1, or HPIB commands. When I try using MAX or even my Agilent IO Control, it shows that there is an instrument connect to GPIB address 10, but neither programs can auto-identify the instrument using the *IDN? query. Even so, I tried typing ID? in both programs and I got no data back from the instrument. I'm not too sure as to what the problem is since I always get "\n" back from the instrument's reply. I even tried changing the termination character enable to TRUE and I still got nothing back.
    However, on the front local display of the switch, I can see arrow indicators moving between TALK and LISTEN whenever I perform a write or write/read command. But no data gets sent or received because I couldn't perform any write commands to change the switch. If anyone can tell me what the real problem is that would be great. But if not, then I will have to use the Call Library Node because I know that my VB6 code actually works on the HPIB instrument and I could simply use this gpib-32.dll file on Labview and perform the same instructions, which should allow me to talk to the switch. Can anyone tell me how to properly set up a Call Library Function Node as I have errors using the gpib-32.dll file (please see my previous message)?

  • How to use Third Party DLL in Adobe Illustrator Plug In

    Hi Everyone,
    I want to design plug-in for Adobe illustrator CS6(64 bit). As first step I am referring sample plug ins from ../SDK/SampleCode. I am not getting how to use third party DLL in plug in.
    Please let me know how to refer C# DLL in illustrator plug in.
    Thanks in advance.

    There's no C# API for the Illustrator SDK, so your plugin must be C++ at the very least. That said, you can probably write a bridge if you need to call out to a C# library/DLL.

  • How to use a c file in LabVIEW

    Hi All,
    I have a c file which communicates through serial port and J1850 protocol. I want to use the C file in labview and do the communication through serial port.
    Can any one give me an idea how I have to use the c file in LabVIEW.
    Thank you.!
    ---------------- Be Good. Do Good. ---------------------

    Have you tried reading the LabVIEW Help or even searching this web site? This question has been asked MANY times. There's a section in the LabVIEW Help called "Calling Code Written in Text-Based Programming Languages." There are also several articles written on this. Here's just one: https://decibel.ni.com/content/docs/DOC-1690
    Please do the research and then come back with a more specific question.

  • How To Use Exported Function "CallInstrument" of LabView.exe ?

    Hello!
    I want to use the function "CallInstrument" to dynamically call VIs with LabView. Did anyone has experiences with this function?
    All I kow is following:
    The function is used by LabView Internals and its Runtime Library. Its exported by LabView.Exe and lvrt.dll.
    Its prototype is maybe:
    int CallInstrument(CPStr* VIPath, int controlcount, int indicatorcount, int options, [ Variable List of Control/Indicator Parameters ]... );
    ( CPStr Type is a StringArray of PStr (Short PascalStrings) as it is used by LabView to store Path datatypes. )
    I whould be glad, if anyone has information about this function.

    Dear Rolf Kalbermatter,
    Thirst, thanks a lot for your answer! -
    You sure right, It whould be much much more comfortable to use the VI Server.
    And you're also right... using a undocumented dll-function is absolutly no longtime solution.
    Currently I am using VI Server for my problem, but it doesn't fit my interesst so much.
    But I will explain, what I'm trying to do.
    I want to call a VI dynamically from LabView, giving Parameters to its Controls and receive Results from its Indicators.
    Realy no big job, but VI Server only let you do this that easy if you have a VI Typedef. otherwise... with untyped VIs, its not that simple. Ok.. its not impossible, you can use "GetAllControlValues" and "SetControlValue" (functions from VI server) and the call "RunVi". But this can get slow (>100ms per call :/ )
    I'm looking for a alternative function, which let me call a VI dynamically with userdefined Parameters. Maybe you know the ActiveX Interface IVirtualInstrument and its Function "Call2" - it is a nice example, what kind of function i want.
    But this function is not directly available by the VI Server--- i don't know for what reason.
    Then i tried to make use of "Call2" from within LabView, and it took me some time to find out the right Parametersyntax but finnaly i got it and it worked fine ... but it was no long time until problems occur. I cannot tell what really went wrong, but sometimes labview simply crashed or hang into a loop reseting some VIs. And its also impossible to stop a running vi, with has made a call to "Call2", if the call doesn't return by itself.
    Next step is/was trying to take advantage of CallInstrument. So, yesterday... after hours of analysing assemblercode, i finnally found out the correct use of LabView.exe->CallInstrument and i'm very impressed about its speed (0-15ms per call). The prototype seem to be the same as you explained in your reply int CallInstrument(Path path, Bool modal, int32 nInputs, int32 nOutputs, ...)
    But It has the same problem as its ActiveX derivat "Call2".. if you call an endless looping VI, LabView cannot stop your caller-vi. The other bad thing is, that this function is using dynamic paramterlist, which are placed directly onto the stack!
    That means that the paramter count on the stack is NOT FIXED (printf makes it the same). LabVIews DLL InvokeNode doesn't support this.
    At my current position, it looks like i have three possiblities but no one fits into my interesst.
    (continued with next answer)

  • How to use a C# dll with JNI

    After a ton of issues, I finally got this working properly. I've come across a lot of forum posts about the various problems and VERY few answers so I thought I would post my solution here.
    To do this, you need to create a managed C++ layer in between C# and java. The JNI functions in C++ dll can make calls to the C# dll directly, and your java program can make calls directly to the native JNI functions. Some important notes on using C# classes in C++ are:
    -gcroot<CSClass ^> should be used on any objects that are instances of some C# class.
    -the symbol ^ should be used with all C# references (its the symbol for references)
    -gcnew should be used to allocate C# objects
    -in visual studio, add the C# dll as a reference rather than using #using <CsDLL.dll>
    -do not use #using <CsDLL.dll>
    The next issue is loading the libraries. By adding the folder your C++ dll is located in to the Djava.library.path VM argument, you can load your C++ library with System.LoadLibrary("Cppdll.dll"). You DO NOT need to load the C# dll in your java program. In fact, it will ignore you if you try. The problem with loading this dll is with how the CLR searches for referenced assemblies. The CLR First searches the DEVPATH environment variable (if the machine.config file has developer mode set to on), then it searches the GAC, then it searches the codebases, then it searchs the current executable's directory along with a list of definable subdirectories (probes).
    DEVPATH is a decent option, but it requires modifying the machine.config file to be in developer mode. Once that is done, it acts just like the PATH environment variable.
    If your C# dlls are strongly named, I would recommend adding them to the GAC or using codebases. However I have not done this and am not sure how.

    Hi,
    i have to use a c# dll in my java program .by following this link http://www.codeproject.com/KB/cross-platform/javacsharp.aspx i done that.but it is working for only one c# program.if i am trying to use a dll it is throwing error
    # An unexpected error has been detected by Java Runtime Environment:
    # Internal Error (0xe0434f4d), pid=3988, tid=3704
    # Java VM: Java HotSpot(TM) Client VM (11.0-b16 mixed mode, sharing windows-x86)
    # Problematic frame:
    # C [kernel32.dll+0x442eb]
    # An error report file with more information is saved as:
    # D:\Work\EclipseWorkspace\HelloInflux\hs_err_pid3988.log
    # If you would like to submit a bug report, please visit:
    # http://java.sun.com/webapps/bugreport/crash.jsp
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    Please help me out. i want a few steps to invoke a c# dll by using jni

  • Using a cygwin DLL in LabVIEW 7.0

    Hallöchen!
    I try to use a function from a cygwin DLL in a LabVIEW 7.0 VI. So
    I wrote
    void funcName(double values[], long number_values)
    for (int i=0; i < number_values; i++) values[i] /= 2.0;
    to the file test.cc and said (cygwin gcc 3.3.1)
    gcc -c test.cc
    gcc -shared -o hall.dll test.o
    Then I included it as a shared DLL in LabVIEW, added the correct
    parameter sequence and return value. The name of the function was
    a little bit different (Z8funcNamePdl).
    But: LabVIEW crashes every single time. Not matter what I say about
    calling convention or reentrance. As soon as the "configure" window
    is closed, *all* LabVIEW windows are closed.
    What am I doing wrong?
    Thank you!
    Tschö,
    Torsten.
    Torsten Bronger, aquisgrana, europa
    vetus

    Hallöchen!
    LarsRoe writes:
    > [...] LabVIEW arrays have a different structure than the
    > traditional C arrays. As a quick test, try passing in a single
    > DBL value by pointer for the first argument, and 1 for the second
    > argument.
    Even a "void Test()" lets LabVIEW crash. I now say
    extern "C" {
    void Test();
    void Test() {
    return;
    > The prototype in your C function needs to match the prototype you
    > get from the "Create C File..." Dialog.
    Granted, but quoting the gcc manual: "Good compilers never crash."
    I didn't *start* the VI after all.
    Tschö,
    Torsten.
    Torsten Bronger, aquisgrana, europa vetus

  • How to use postlv user event in labview

    Hi sir 
     I am sending data labwindow cvi dll call to labview,for that we need postlv user event.please any one knows to use postlv user evenet in labview.
    Below will  be the  structureand i need to update in labview .
    typedef struct
    unsigned
    uDSPIO,
    // uDAQMode,
    // bControllerActive,
    bShutDown,
    bPowerOn,
    bPowerHi,
    bPowerFault,
    bSGIdle,
    bSGHold,
    uBitsIn,
    uBitsOut,
    uCycleCount,
    uCycResidue,
    uBlockCount,
    uLogChannels,
    uCurrentMode,
    uAsigndPhysCh[LOG_CHANNELS];
    float
    fSetPoint,
    fDAQRate,
    fRange[LOG_CHANNELS],
    fReadout[LOG_CHANNELS],
    fMax[LOG_CHANNELS],
    fMin[LOG_CHANNELS];
    char
    sChID[LOG_CHANNELS][32],
    sChUnits[LOG_CHANNELS][16];
    CTRL_CHANNEL_STATUS;
    Attachments:
    GDSCallback.vi ‏12 KB

    AThe fixed size arrays in your structure are inlined byt the C compiler. This means they are not an array pointer (and definitely never a LabVIEW array handle) but rather LOG_CHANNELS amount of unsigned ints and floats directly embedded in the structure. In LabVIEW terms this is most easily represented as a cluster with LOG_CHANNELS elements inside the main cluster.
    So basically your uAsigndPhysCh needs to be a cluster with LOG_CHANNELS elements of unsigned ints and  fRange,  fReadout, fMax and fin are clusters with LOG_CHANNELS single precision float values, and then sChID is a cluster with 32 * LOG_CHANNELS chars and sChUnits one with 16 * LOG_CHANNELS chars.
    However I would personally rethink this strategy. This huge cluster monster is passed into PostLVUserEvent() each time and copied into the event data on every event, causing quite a bit of overhead that way. Is it really necessary to post all this data every time?
    Also you have commented out uDAQMode and bControllerActive in your C structure but included it in the LabVIEW cluster which will certainly throw off your data. Last but not least the b prefix would probably indicate that you are only using that element as a boolean value, so why not consider to use bit fields there? In LabVIEW you can easily seperate those bitfields by either translating the resulting uInt32 into a boolean array or even more efficiently use boolean logic to detect the bits.
    And in order to let LabVIEW react on a user event you have to create that user event with the correct datatype (your cluster monster) and then pass the user event refnum to your DLL. This DLL then calls PostLVUserEvent() with the user event refnum as first parameter and a pointer to a data structure that matches the LabVIEW user event datatype EXACTLY whenever it wants to post an event to LabVIEW. The user event is also registered in an event structure in LabVIEW which will then get triggered everytime your DLL posts an event by correctly calling PostLVUserEvent().
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • How to use XVID MEPG4 DECODER in labview

    May i ask how to use Xvid MEPG4 Decoder to compress the AVI file. For this decoder have been installed in my computer but the VI(IMAQ AVI2 Get Codec Names)can not list this code name. So may i ask how can i use this decoder in the labview. For this decoder is relatively has good quality and also small size. Or what kind of other solution can be provieded for the relative small size of AVI file.
    Thanks
    Daniel

    I believe this was answered already in a different thread:  http://forums.ni.com/t5/LabVIEW/LabView-to-grab-and-save-video-to-mpeg/m-p/643864
    www.movimed.com - Custom Imaging Solutions

  • How to use a VB dll file in java

    hi,
    i am working on college project,In this output of calculation is not matching with college site .So any one can tell "how to use or combine a VB 'dll' file in java?".so that i can use VB 'dll' file in java to get right Output.
    If possible write code or send it to "[email protected]"
    Thanks
    Ravi kapani

    Did you try Google? And no, there is no native support for accessing .dll files from Java. That said, take a look at JNI.

  • How to use a GPIB card's LabView drivers to communicate with the card?

    I have an axiomtek AX4810P PCI-GPIB card and i have aquired LabView drivers from the manufacturer.
    This has put VI's for the GPIB functions on the 'user palette' but i can't work out how to use them to communicate with the card. can anyone help? please.

    LS,
    Thank you for contacting National Instruments.
    Unfortunately, since you are not using a National Instruments GPIB card, I do not have access to the drivers that were provided to you by your card's manufacturer. I would suggest contacting Axiomtek directly to obtain support using their drivers.
    However, I did write a small VI that demonstrates how to use similar National Instruments drivers with a National Instruments GPIB card. Keep in mind, this example VI is not intended to work with your particular card. The drivers you obtained from Axiomtek may have similar functions, however, and you can use my VI as a guide. My VI allows you to send a command to an instrument at address 2 on the GPIB card.
    Hope this helps!
    Matthew C
    Applications
    Engineer
    National Instruments
    Attachments:
    GPIB_Communication.vi ‏23 KB

  • How to Update the C# dll in LabView

    Hi.,
     i created C# dll with "ADD"  Function. in that dll contains only that function. for that function i am passing two variables.
     "public int Add(int A, int B) "
    in the Labview, i use the .NET constructor(Drag and drop the node and in the dialog box i browse the .net dll) and Invoke node to access the
    method it's working fine..
    Now the Problem, After build the dll i added some more function in the c# dll.
    "public int Sub(int A, int B) "
    In the labview i can't see the new method in the "Invoke Node". so in the ".NET Constructor" dialog box i browsed the same dll but i got the Message "The version of assembly you requested was automatically  promoted to a newer version by the .net runtime engine"
    the newer version of the dll not updating. How to get the newly added function.
    Please help to fix this problem

    Try to delete the constructor, save the VI, add a new constructor and select your dll again.
    It's a workaround proposed here : http://forums.ni.com/ni/board/message?board.id=170&thread.id=229618
    Regards,
    Gilles K.
    Electronic System Engineer, Renault F1

  • How To use or call dll ?????

    Hi !
    I have created one programm and i have genetared dll of that ( Using
    LabVIEW) now i want to call that from vb.net how i can Do it
    please help
    Thanks in advance

    tst wrote:
    Lycangeek wrote:
    But you can't get a front panel control integrated into a VB.NET panel.
    Brian,
    this is obviously impossible when the control is part of a running
    program, but don't the LV style control appear in the list of
    registered ActiveX controls as ComponentWorks controls? I'm
    not near a computer with LV at the moment to check.
    No
    almost all LabVIEW controls are native implementations in LabVIEW
    itself. They have nothing to do with Component Works or Active X at
    all, although I guess the Component Works developers did get some
    inspiration from LabVIEW controls but even more probably from
    LabWindows/CVI controls.
    Exception to this is the 3D graph which is a Component Works control
    incorperated into LabVIEW through the Active X control container (and
    my own private opinion about this control is that it sucks in several
    aspects, being an Active X control is not the least of its faults).
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

Maybe you are looking for

  • What is the use of Custom Controller in ABAP WebDynpro?

    Hi, Can you explain me about Custom Controller and its uses and some example on it? I have gone through SAP help but not understand clearly. Wish to see some good explanation here? Thanks in advance. Regards, Meera.

  • Posting document not created (Pricing Error)

    Hello Everybody, I have a problem with a invoice. If i go to VF03, I can see a positing status as F Posting document not created (pricing error). The error message is showing as pricing error in item 000010 Message No. VF 073. Kindly help me how to u

  • Multisocket no data received

    Hi, I have these 2 codes for sender and receiver: public class Server { static String mcastIP = "239.0.0.100"; static int mcastPort = 50002; public Server() {} public static void main(String args[]) { try { mcastComm(); } catch (Exception e) { System

  • My OS is at 10.5.8 and will not update to 10.6.8?

    My Mac book pro updated to 10.6.8 without a problem and I amready to install LION on it. However, my iMac is at 10.5.8 and when I prompt it to find an update it comes back saying there is no update avail. I need to update it to 10.6.8 so I too can in

  • Terminal.app

    Hi, when starting the terminal.app I am getting this: The terminal startup preferences are: This happens on a very new MacBook Pro, Mavericks 10.9.5 from the very first use of Terminal.app. I am in dire need of using Terminal in order to set up and c