Building DLLs with Returntype as string

Is it possible to pass strings to a function and get a return type as a string.
Actually iam facing a issue ,
I have built a VI with Input and output as strings,the VI is working correctly
when the dll for that VI,
Function prototype is always void and output is always passed as a reference parameter to the function.
Attachments:
Output return option..JPG ‏164 KB
Return value option.JPG ‏157 KB

Hi,
Building DLLs in LabVIEW is described in this tutorial.  
Mathscript can call shared libraries such as DLLs, however make sure
that they are compliant with the supported data types as stated here in
this help page.  All supported functions for calling/loading shared libraries is described here. 
Note that these functions are not supported with the base package.  The
details of the sytax of each function is described in their specific
help page.
Hope this helps!
Regards,
Nadim
Applications Engineering
National Instruments

Similar Messages

  • Building dll with front panel

    Hi all,
    do you know, can i build with LV Builder dll that will run with Front Panel open when i call it from some another VI?
    I tried build it, but not succesfully.
    The prolem was that if i select in VI properties "Show FP when loaded", dll runs with FP open, but property "Show FP when called" doesn't give same results. Dll runs, but in background.

    Nadav,
    Did you see this recent post about LabVIEW calling LabVIEW DLLs?

  • Building DLLs from VIs with array as output

    Is there any special way to build DLLs from VIs having arrays as outputs. Suppose I have a VI "Random" with input "nrand" and output an array "the_random2". When I build DLL from the VI, I have something like this in my header file
    void __stdcall Random(long nrand, double the_random2[]);
    Now it returns void. So I have to pass the array as pointer and retrieve it. If I use Mathscript to load the DLL and call this function, how do I pass the pointer to the array "the_random2"? Simply speaking, any useful method to build DLLs with array outputs and the right way to call them from Mathscript would be appreciated.
    Regards
    NRK

    Hi,
    Building DLLs in LabVIEW is described in this tutorial.  
    Mathscript can call shared libraries such as DLLs, however make sure
    that they are compliant with the supported data types as stated here in
    this help page.  All supported functions for calling/loading shared libraries is described here. 
    Note that these functions are not supported with the base package.  The
    details of the sytax of each function is described in their specific
    help page.
    Hope this helps!
    Regards,
    Nadim
    Applications Engineering
    National Instruments

  • Unable to create a Driver object from driver with Media type string CTC PHO

    Hi All,
    I am trying to develop a siebel cti adapter for avaya.
    I have loaded a custom dll into siebel server but it is throwing error "SBL-CSR-00500: Unable to create a Driver object from driver C:\Mydriver\cti.dll with Media-Type-String CTC Phone ".
    It has been long time without any progress.
    Please help
    Thanks
    Nishant

    Hi tomhowell,
    According to your description, my understanding is that you got an error when you created a site from a custom site template after migrading SharePoint 2010 to your server.
    Did you have the original solution file of the site template? Please re-deploy the solution to your SharePoint site, then create a site from the new site template, compare the result.
    Also use  SPDisposeCheck to indentify the memory leak:
    http://archive.msdn.microsoft.com/SPDisposeCheck
    http://www.fewlines4biju.com/2012/11/detected-use-of-sprequest-for.html
    Here are some similar posts for your reference:
    http://social.msdn.microsoft.com/Forums/sharepoint/en-US/3a25eb86-8415-4053-b319-9dd84a1fd71f/detected-use-of-sprequest-for-previously-closed-spweb-object-please-close-spweb-objects-when-you?forum=sharepointdevelopmentprevious
    http://social.msdn.microsoft.com/Forums/en-US/50ce964f-94a6-4fda-abc0-caa34e7111f1/error-detected-use-of-sprequest-for-previously-closed-spweb-object-occurs-when-new-site-gallery
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • Error Building DLL, LabView 8.2

    Hello everybody,
    I'm building a
    CVI application. I need some functions of LabView (related to time
    series analysis), so I'm trying to build DLLs with the .VIs I need. I
    followed all the steps necesary and visited all the related topics at
    ni.com. I always get the following error:
    Visit the Request Support page at ni.com/ask to learn more about resolving this problem. +¡
    Use the following information as a reference:
    Error -2147221480 occurred at Building DLL stub.
    This can be caused by illegal function or parameter
    names. Please verify your names are legal C identifiers and do not
    conflict with LabVIEW headers
    This error code is undefined. No one has provided a
    description for this code, or you might have wired a number that is not
    an error code to the error code input.
    Once, I got a correct DLL with no errors, so it should be possible for others.
    This is an example of what I'm trying to compile:
    And this is what appears, only for a moment, at the end of the
    compiling (it didn't appear when I manage to build with no errors):
    I'm using: LabView 8.2, LabWindows CVI 8.5, NI-DAQ 8.5, Windows XP (SP2)
    Any suggestion is really appreciated.
    Maybe another way to use this functions in CVI (I need functions related to spectral estimation, ARMA; MUSIC,...)
    thank you!
    Eduardo Tamargo
    Spain

    Hi Tamargo,
         The following KnowledgeBases may help you find out what is happening:
    Creating and Calling LabVIEW DLLs with Various Data Types from Microsoft Visual C++
    What are the Differences Between "Array Data Pointer", "Array Handle", and "Array Handle Pointer"?
    Calling a LabVIEW DLL from C with an Array in a Cluster as a Parameter
         Have you tried developing a very simple VI with an array as an input parameter and checking if the same problem takes place when you build the DLL?
    Regards,
    David Oña

  • C++ build error with LabVIEW DLL

    Hi, I'm a student at UC Irvine learning to use LabVIEW.  I am working on a practice project for which I have to use a PID system to control the temperature of an object.  Things are starting to get a little messy with nested control statements, loops, etc., so I figured I'd export a LabVIEW DLL with all the hard to code stuff, such as interfacing with my instruments, and plotting data or whatever, and do the number crunching and keeping track of stuff in C++.
    The DLL file I made in LabVIEW went off without a hitch as far as I can tell, but when linking it to my C++ test program (which at this point is just including the LabVIEW's .h file for the DLL and an empty main() function), I get a lot of build errors.  I am using Dev-C++ which uses g++ to compile the code.
    Here is a pic of my build errors:
    Solved!
    Go to Solution.
    Attachments:
    LabVIEW_compile_error.JPG ‏184 KB

    Normal windows apps are not as forgiving about where you can put your DLL as LabVIEW. You have to have a DLL either in the direcotry where the executable file itself resides (that would be your build directory, not the source directory), the windows or system directory, or any directory that is set in the PATH environment variable. Anythin else will most likely not work, or at least not reliably.
    No need to add the cintools directory into your include file paths nor the library file paths. you would only need that if you decided to let the DLL export native LabVIEW data types in which case you would need the LabVIEW manager functions to prepare the correct data buffers.
    Rolf Kalbermatter
    Message Edited by rolfk on 07-30-2009 07:49 AM
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Build dll error in application builder 8.6.1

    Hello,
    I get always an error in the LV 8.6 application builder, when I build a dll. There is only one function in it, that has a string and an error input, and nothing else. I attach a screenshot of the VI prototype, and hier is the error description:
    Error 1 occurred at Building DLL.
    A component needed for Application Builder does not support the required functionality. This might have been caused by installing an older version of LabVIEW after this version was installed. Reinstall the current LabVIEW version to correct this issue.
    Possible reason(s):
    LabVIEW:  An input parameter is invalid. For example if the input is a path, the path might contain a character not allowed by the OS such as ? or @.
    =========================
    NI-488:  Command requires GPIB Controller to be Controller-In-Charge.
    After that I reinstalled LV8.6, I tried to reinstall only the 8.6 app builder, but no success.

    Hello,
    thank you for the reply.
    I have solved the problem. I uninstalled the last installed LV version, this was 8.0. Then ran appbuilder again in 8.6, then I have got an instruction to run applibs\lvdllbuilder\lvdb.exe. Since then works.
    regards
    Mitulatbati

  • Create dll with arrays and call it

    I am trying to create dll with labview in order to pass a 2d array to the main program. The problem is that I don't really know how to create the function to call it (I don't know much about pointers)
    The function I have created to call the dll is void Untitled1(TD1Hdl *Array1) which is suposse to return the array created on it.
    For example, in the program attached, how should I do to pass the array to another program using dlls?
    Thanks a lot,
    Juanlu
    Attachments:
    Untitled 1.vi ‏7 KB

    The code you've provided doesn't do anything (just a control wired to an indicator) so I'm not sure what you're asking here.
    If I understand correctly, you want to build a DLL from your LabVIEW VI.  From what language will you call that DLL?  There is no standard way to pass a 2-D array.  If you can convert to a 1-D array, you can use a simple pointer.  With a 2-D array, you're stuck with LabVIEW's array representation (the TD1Hdl type), which means that whatever code calls that function will need to understand the LabVIEW data type and how to manipulate it.

  • JNI: experience in creating DLLs with G++ (mingw32)?

    Hello.
    I'm trying to create a DLL:
    --------------/HelloWorld.cpp/------
    #include <jni.h>
    #include "HelloWorld.h"
    #include <stdio.h>
    JNIEXPORT void JNICALL
    Java_HelloWorld_displayMessage(JNIEnv *env, jobject obj)
    printf("Hello world!\n");
    return;
    I previously created 'HelloWorld.java'
    class HelloWorld
    public native void displayMessage();
    static
    System.loadLibrary("HelloWorldImp");
    I created 'HelloWorld.class'.
    I created the header file 'HelloWorld.h':
    c:> javah -jni HelloWorld
    But I do not have any idea to create the DLL.
    I tried with:
    c:> g++ -I"D:\j2sdk\include" -I"D:\j2sdk\include\win32" HelloWorld.cpp -shared -o HelloWorldImp.dll
    But I get this error message when calling from 'Main.java':
    Exception in thread "main" java.lang.UnsatisfiedLinkError: displayMessage
    at HelloWorld.displayMessage(Native Method)
    at Main.main(Main.java:6)
    In order to get this message I created 'Main.java':
    class Main
    public static void main(String[] args)
    HelloWorld hello = new HelloWorld();
    hello.displayMessage();
    Does anybody have any experience in creating DLLs with G++???
    Thank you very much.

    Or is it better GCC?

  • Can I call a dll with a C++ Class Cstring variable?

    So,
    we bought an optiphase interferometer, and it comes with a dll and with LabVIEW example code.
    However, there is a big problem!
    The dll is a C++ dll and requires the C++ Cstring class!
    for example I can't get the function Boolean LoadDemodulatorDSPCore(Cstring arg1, U8Bit arg2) to work.
    They did provide a GetDllVersionchar(Cstr arg1, long arg2) which does work, (offcourse, it uses a standard C string pointer)
    but GetDllVersion(Cstring arg1) does not work. (offcourse not, it using the Cstring class)
    Is there a way to get CString classes to work in LabVIEW? (with a struct, or an binary array or whatever?)
    Or do I have to write a wrapper dll to convert CString classes to standard C string pointers?
    Thanks.

    Nils Gokemeijer wrote:
    So,
    we bought an optiphase interferometer, and it comes with a dll and with LabVIEW example code.
    However, there is a big problem!
    The dll is a C++ dll and requires the C++ Cstring class!
    for example I can't get the function Boolean LoadDemodulatorDSPCore(Cstring arg1, U8Bit arg2) to work.
    They did provide a GetDllVersionchar(Cstr arg1, long arg2) which does work, (offcourse, it uses a standard C string pointer)
    but GetDllVersion(Cstring arg1) does not work. (offcourse not, it using the Cstring class)
    Is there a way to get CString classes to work in LabVIEW? (with a struct, or an binary array or whatever?)
    Or do I have to write a wrapper dll to convert CString classes to standard C string pointers?
    Thanks.
    I'm afraid this won't really be
    possible without a wrapper DLL. A CString is more like an object with
    internal pointers and last time I checked into a DLL with a
    disassembler it seemed that the actual layout of the internal structure
    depends on the size of the string that is contained, with small strings
    being entirely embedded and larger strings being a pointer to the
    string. Trying to figure out these difficulties is something you should
    leave to compiler developers and not try to do yourself.
    One way that might be possible is to actually only create three or four
    C functions that are exported by a helper DLL. These functions would
    allocate a CString, copy a CStr into it and out of it and one to
    deallocate it. As far as LabVIEW is concerned you would treat the
    CString simply as a uInt32.
    Rolf Kalbermatter
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Building DLLs

    I'm learning JNI and I try to use the sun's tutorial at: http://java.sun.com/docs/books/tutorial/native1.1/index.html
    I can do everything with Java, but I can't compile the .c, my compiler (dev-c++) reports an error message in the first line: #include "jni.h".
    And this tutorial just shows how build a dll with MS Visual C++, I need to do this with Dev-C++, does anyone knows how?
    Thanks.

    This is the full error report. This message still appear, but I can generate the ".o" object file and build the DLL with him. Now the problem is the Java program, they report tis message:
    "java.lang.UnsatisfiedLinkError: displayHelloWorld
         at jni.HelloWorld.displayHelloWorld(Native Method)
         at jni.HelloWorld.main(HelloWorld.java:19)
    Exception in thread "main" ".
    I read in another message some solutions like put the library path in the path enviroment, or put the code extern "C" in the C program. Doesn't work!!!
    I need to make a program in C to read systems info like disk capacity and free space, but I can't even make a Hello World Example, it's hilarious :)))
    I'll appreciate any solution!
    Thanks
    []s
    Gabriel.

  • Make a DLL with LabView??

    Hi LabViewers!!
    I'm doing a program with C++Builder and I would like to use some
    features from LabView, and I think that I can do that creating a dll
    with LabView but I dont know if this is possible. Could someone tell me
    if there is another way on making this task?
    Thanx in advance.
    Juanmi.
    Juan Miguel Delgado Garcia de Soria.
    Electronic Engineer.
    Universidad de Cádiz. (SPAIN)

    > I'm doing a program with C++Builder and I would like to use some
    > features from LabView, and I think that I can do that creating a dll
    > with LabView but I dont know if this is possible. Could someone tell me
    > if there is another way on making this task?
    >
    LV can't build DLLs yet. If you are using a recent version, > 5.0, then
    you can use the server interface to have LV carry out an execution and
    pass back the results. This will work in a separate EXE, even on another
    computer if that helps.
    The server works LV->LV over TCP, and it also supports ActiveX; so other
    environments can control it and have it do executions for them. There
    are also some C++ classes on the ftp site that make the ActiveX controls
    a little more natural in C++.
    Greg McKaskle

  • Access ni4882.dll with Qt and MinGW

    I have to control some electric loads and power supplies over GPIB. We use Qt 4.7.4 with MinGW 4.4 (32-bit) on Windows 7 64-bit.
    The packet NI-488.2 GPIB Drivers packet 3.0.2 for Windows 7 64-bit is installed. The GPIB Troubleshooting Utility tool shows "pass" and the Measurement & Automation application can connect to the board and talk to an intrument. So far so good.
    Now I want to write an application to use the NI4882.dll (3.0.0.49153). Unfortunately, there are just object files for Microsoft and Borland compilers and no lib file.
    So we generate a def file from the ni4882.dll with:
    pexports -h ni4882.h ni4882.dll > ni4882.def
    -ni4882.def-
    LIBRARY NI4882.dll
    EXPORTS
    ?compareVersion@nGPIBAPI_NI4882@@YGXABVtSSVersion@@0AAJPBD@Z
    ?getCurrentVersion@nGPIBAPI_NI4882@@YG?AVtSSVersion@@AAJ@Z
    ?getOldestCompatibleVersion@nGPIBAPI_NI4882@@YG?AVtSSVersion@@AAJ@Z
    AllSpoll@12
    DevClear@8
    DevClearList@8
    Then generate the lib with:
    dlltool -k -D ni4882.dll -d ni4882.def -l libni4882.a
    Now, I've build a small test program in Qt.
    -.pro file-
    INCLUDEPATH += $$PWD/include
    LIBS += $$PWD/lib/libni4882.a
    -.cpp file-
    #include "ni4882.h"
    void MainWindow::Init()
      int dd = idev(0,3,0,T10s,1,0);
      if(Ibsta()&ERR)
        Err(tr("Unable to open board:ibdev=%1").arg(dd));
      if( ibonl(0,0)&ERR)
        Err(tr("Unable to close board"));
    void MainWindow::Err(QString message)
      switch(Iberr())
        case 0:
          message.append("(EDVR - System error)");
        } break;
      qDebug("Error : %s\nibsta = 0x%x iberr = %d\n",
        (unsigned int)Ibsta(), (int)Iberr());
    The source code will be compiled and linked without an error.
    But if I run it, the output is:
    Error : Unable to open board: ibdev=32768 (EDVR - System error)
    ibsta = 0x8000 iberr = 0
    Error : Unable to close board (EDVR - System error)
    ibsta = 0x8000 iberr = 0
    So, the question is: What is wrong? Why do I always receive this EDVR error. I also tried SendIFC(0) with the same result.
    With the GPIB Interactive Control tool, I can communicate with my instrument and the NI I/O Trace logs it. But I can't see logs in the Trace tool from my application. Is this an indication?
    Any ideas?
    Marko
    Solved!
    Go to Solution.

    Hi to all,
    after some questions about using the GPIB library with Qt, I've written a step by step description to create object files for MinGW:
    1. Create a folder and copy the "gpib-32.dll" from the "C:\Windows\System32" ("C:\Windows\SysWOW64" in Win7) to this folder.
    2. Copy "ni488.h" from "c:\Program Files (x86)\National Instruments\Shared\ExternalCompilerSupport\C\include\". (Not ni4882.h!)
    3. Load PExports (my version is 0.44) and put the exe in your folder to. I do not have a URL to load this tool but should be easy to find. It's freeware.
    4. Copy dlltool.exe from "c:\QtSDK\mingw\bin\" to your folder.
    5. Create a batch file "1 - build def file.bat" with the content: "pexports -h ni488.h gpib-32.dll > gpib.def"
    6. Create a batch file "2 - build lib file.bat" with the content: "dlltool -k -D gpib-32.dll -d gpib.def -l libgpib.a"
    7. Start the batch file "1 - build def file.bat" to create the def file "gpib.def"
    8. Start the batch file "2 - build lib file.bat" to create the library file "libgpib.a"
    9. Copy "gpib-32.dll" and "libgpib.a" to your software project. I created the subfolder "lib" and copied the files into.
    10. Copy "ni488.h" to your software project. I created the subfolder "include" and copied the file into.
    11. Into your PRO file type:
    # Include the NI 488.2 library
    INCLUDEPATH += $$PWD/include
    HEADERS += include/ni488.h
    LIBS += $$PWD/lib/libgpib.a
    12. In your source code type:
    #include "windows.h"
    #include "ni488.h"
    bool InitializeGPIBBoard( )
    bool isStarting = false;
    int boardID;        /** @brief Board id. */
    QString boardName;  /** @brief Board name. */
    int boardDescr;     /** @brief Board descriptor. */
    // Get board ID
    SendIFC(boardID);
    if( ThreadIbsta() & ERR )
        ErrorHandling(tr("Unable to open board"));
        return isStarting;
    // Open and initialize a board or a user-configured device descriptor
    wchar_t *aName = new wchar_t[boardName.size()+1];
    m_para.boardName.toWCharArray( aName );
    aName[boardName.size()] = 0;
    m_para.boardDescr = ibfind( aName );
    delete []aName;
    // The board is the System Controller.
    if( ibconfig( boardDescr, IbcSC, 1 ) & ERR )
        ErrorHandling(tr("Unable to set the board to System Controller"));
        return isStarting;
    // Assert interface clear.
    if( ibsic( boardDescr ) & ERR )
        ErrorHandling(tr("Assert interface clear"));
        return isStarting;
    // aso.
    isStarted = true;
    return isStarted;
    13. Be happy! :-)
    I hope that helps. If you have problems, please write me a message or post on this board thread.
    Gruß und viel Erfolg!
    Marko

  • Building Dll for labVIEW RT gives errors

    Hi All
    Does building dll for labVIEW RT using CVI require labview runtime engine to be installed?
    becuase i get some errors of unsatisfied referances to some library while building the dll with target selceted to "labVIEW real time only".
    Regards
    Arun

    Hello Arun,
    You don't need to have LabVIEW Run Time installed on your machine. Please check the link below to see the function that are supported by exporting the LabWindows/CVI LabVIEW RT Engine
    http://digital.ni.com/public.nsf/websearch/D3EFE7C6F073384886256FDD005FBCDA?OpenDocument
    Ame G.
    National Instruments

  • Error -2147221480 occurred at Building DLL stub

    When I build a Shared Library, I get following error message
    Error -2147221480 occurred at Building DLL stub.
    This can be caused by illegal function or parameter names. Please verify your names are legal C identifiers and do not conflict with LabVIEW headers
    This error code is undefined. No one has provided a description for this code, or you might have wired a number that is not an error code to the error code input.
    Can anyone help me out regarding this error...

    To begin with, do didn't say whether you have checked the two possible errors listed in the error message:
    1) the function and parameter names are legal C identifiers
    2) the function and parameter names do not conflict with LabVIEW headers
    How many functions does your DLL have? What are their names?
    What parameters do the function(s) have? What are their names?
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps

Maybe you are looking for