Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Using LabVIEW Built DLLs in ASP.NET

Primary Software: Measurement Studio>>.NET Support
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: LabVIEW Development Systems>>Professional Development System

Problem:
I have an ASP.NET website. I have written ASP.NET code in C# that calls a function in my LabVIEW built DLL. When I run my ASP.NET code, I get the following error message: Unable to find an entry point named Function_Name in DLL_Name.dll. How do I correctly call a function from a LabVIEW built DLL in ASP.NET code?

Solution:
To correctly call a function from a LabVIEW built DLL in ASP.NET code, follow these steps:
  1. Include using System.Runtime.InteropServices at the top of the ASP.NET code.
  2. Import the DLL to the ASP.NET code using the DLLImport function. Make sure you include the exact path to where the DLL is located on your computer. Also, make sure you call the DLLImport function before you call the method thats uses the function from the DLL.
    Example:
    [DLLImport(@"C:\Documents and Settings\DLL_Name.dll")]
  3. Declare the function from the DLL in the ASP.NET code. Make sure you declare the function before you call the method that uses the function from the DLL.
    Example:
    public static extern double Function_Name (double Var1, double Var2);
  4. Add the DLL as a reference to the ASP.NET project. To add the DLL as a reference:
    Open Solution Explorer, Right-click on the Website, Select Add Reference, Browse to the location of the DLL, Select the DLL, and Click OK.


Related Links:
KnowledgeBase 2TOIMGRT: How Do I  Use a LabVIEW DLL in Microsoft Visual Studio.NET?

Attachments:





Report Date: 01/14/2008
Last Updated: 01/18/2008
Document ID: 4HDIAH6V

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit