LabVIEW built of DLL in an application multi-threaded C++, need help!

I'm working on a software application which is developed mainly in C++. There is a component of this larger application, however, develop in LabVIEW (for several reasons that I dive in here). This LabVIEW code is therefore run in a C++ wrapper class that calls a built DLLS LabVIEW.

All this was fine and dandy, until we decided to multi-threaded, our C++ application for an increase in performance. Accordingly, the LabVIEW DLL now is called from multiple threads simultaneously. While this works on a functional level, it seems to create a bottleneck.  All my tests, it is resource locking occurs, such that only one thread has access to the .dll at a time. If I do the .vi used to define the dll as a non-reentrant function prototype so it's what we see. For example, say we have 3 sons all calling the same .dll method call. Thread 1, 2, 3 and all call the .dll file in a few milliseconds of each other. Thread 1 has completed the call .dll after X milliseconds. Thread 2 has finished the .dll call after 2 X milliseconds, and wire 3 full after 3 x milliseconds.

Now, changing the vi home and runs the same test, we see wire 1, 2, 3 and all end them the call of .dll in 3 x milliseconds. While the fact that they are now the same amount of time to complete you would lead to believe they are spend at the same time, the fact that it takes 3 x milliseconds as opposed to X milliseconds means that they are not.

Has anyone ever dealt with these issues before? Is it possible to play with the "delivery system" for the vi will have an effect? What happens if .dll methods while remaining attached to the same .dll are called from different threads? Same behavior? Is it a lost cause? Is there any way to make the code in a DLL only built LabVIEW run in two different threads at the same? What I understand is easily achievable with a normal (non - built LV) .dll.

Please, if anyone has any advice in this area, let me know!

Much appreciated,
Jesse Hurdus

Hi jhurdus,

I know that you are working with an engineer OR this question, but I wanted to post a reply to one of your last questions.

When you use the function node library call in LabVIEW, there is the possibility to select 'Run in the user interface thread' or 'run in any thread '.  This option, according to the help file for LabVIEW (dialog box call library functions), allows the developer to pass thread library function node call from the (default) user interface thread to the thread that the VI is running.  Additional details of when you want to switch the thread of execution are in the help file.

Kevin S.

Technical sales engineer

National Instruments

Tags: NI Software

Similar Questions

  • Porting an application multi-threaded for Adobe Air.

    Someone at - it never been faced with this task?

    The application in question has a thread about 10 in addition to the main user interface thread.

    Each thread is blocking ops in long-distance communication, GPS, HTTP, manipulation of the filesystem, processing of data of general application, SQL execution, etc.

    Very little of it is based on the direct interaction of the user.

    Is it possible to get something like this in Adobe Air?

    Or simply wait for Android/BB... which would be realistic player out right at about the time where that this port is complete.

    Support an implementation not threaded with threaded implementations could be a lot of work.  I would recommend waiting.

    AIR has a flash.utils.Timer class, or a simple setTimeout() call that uses only the timer below.  The question is not "burden" on the UI thread, depending on CPU load... work has to be done one way or the other.  The issue is latency, in terms of how long it takes the application to respond to user events, or how long to make the updates.  Do more that small pieces at a time in the main thread, you will feel your app slow and inconsistent, with irregular updates and (if you try) animations jerks.

    Thread safety is not a big deal, normally... it is a matter of concern for applications poorly structured in a multithreaded environment.  Properly structured multi-threaded applications will eventually look a lot like an AIR application, with respect to certain things (for example, GPS pilot or connections SQLite) communicating through mechanisms of threads (queues, events, etc.) with the main thread.

    Called async stuff basically back to the main thread.  What are the event listeners.  You might be better not think of it as a wire when even... it's not like your "main thread" in another application, perhaps, where you have full control.  This is the main thread in a framework of GUI like WxWidgets or QT or whatever... everything is done with events and you * must * return to the caller (the frame) as quickly as possible or you will have a user experience impact.  Basically, the entire application is a collection of event listeners, with no place where you can implement a "loop of interrogation" for example, as you might in a different environment.

    Rather than stuff on 'simple threaded environments', you should probably just search for "asynchronous programming" or "event-driven" stuff.  There not much more to it than that.

  • error when pass array 1 d by data in table pointer via Labview-built c++ dll

    I'm trying to generate a Labview VI to a DLL and let it be invoked by vc ++, by which a 1 d array is passed. However, I can't generate the DLL when you use the data pointer to the table, which gives the error like below:

    [ERROR]
    Code :-2147221480
    Strengthening of the DLL.
    Error when compiling the DLL as a function name or a parameter is illegal. Check function and parameter names are legal C identifiers and are not inconsistent with the LabVIEW headers.
    Additional information: 9 project link errors
    Type Library generate error. MIDL.exe failed during the compilation of the odl file used to create the type library.
    Note: The error indicates that the odl file has unknown types. This error is possible when
    works with non-standard types is exported using the method qualifier exporting files in
    release the configuration that have not been recompiled during the build process.

    The Prototype of VI define is as below

    But, if I use the pointer to manage through the table, the generation is successful, error-free. I write something to call the DLL built labview, which basically reads 1000 double the data of an instrument.

    #include "TestDQMaxDLL.h"
    #include 
    
    using namespace std;
    
    int main(int argc, char** argv) {
        cout << "Start testing DQMax DLL" << endl;
    
        int leng{ 1000 };
        DoubleArray rawDPData = AllocateDoubleArray(leng);
        test_dqmax_dll(&rawDPData);
        cout << "Successfully invoked the DLL!" << endl;
        cout << "DoubleArray.len: " << (*rawDPData)->dimSize << endl;
        for (int i = 0; i < leng; i++)
        {
            cout << (*(rawDPData + i))->elt[0] << "\t";
            if (0 == i % 10)
            cout << endl;
        }
    
        system("pause");
    
        DeAllocateDoubleArray(&rawDPData);
    }
    

    But the printed results are not correct.

    My questions are:

    1. why cannot generate DLLS with the data of table pointer. In this case, the argument of the function is as simple as a double array.

    2. for table handle pointer, when the resutls are incorrect and how to get the good ones.

    Any comments would be appreciated.

    BTW: I use Labview 2012 with Visual c ++ 2013 on Windows7 64 bit.

    I never needed to pass a table of LabVIEW handle external code. Search this forum for posts of RolfK, it is most likely to have posted such an example. I recommend that you keep things simple and remodelling your table a table 1 d 2D before moving on to external code and manage as a 1 d table (it's just a little extra math).

    Sorry I don't have a solution on why you can't build with a 1 d as a pointer of table table. If you post your project I'm happy to try to build (I'm on LabVIEW 2012, however), but as you said, it will rely on another machine, it seems more likely to be a problem with something on the specific computer where there is a problem.

  • How to use global variables from a dll in another (not multi-threaded)

    With LabWindows/CVI. I try to be compatible with legacy code, so this isn't the best way to do things, but it saves me some headaches.

    I have a project/.dll called "GlobalBlock" that contains some parameters used widely throughout the program. The entire program consists of several DLLs, for the purpose of encapsulation.

    GlobalBlock.c contains:

    menu_sdef G_setprefs = struct
    {
    ... stuff

    };

    sys_fileheader_sdef Level1Version = struct
    {
    ... more

    };

    struct G_sys_flags sys_flags_sdef;

    In the dll that owns the variable, use the _export on this qualifier. This will ensure that it is placed in the list of the interface dll. In the application (dll or other) that wants to make reference to that variable, use the qualifier _import on it. This tells the system to use the associated import library that comes with the dll in order to resolve references running.

    JR

  • my laptop has built in webcam, but I can't find this need help where is it? I have a compaq CQ56 PORTABLE presaio

    I HAVE A COMPAQ PRESARIO CQ56 LAPTOP WITH BUILT-IN WEBCAM DOES NOT. WHERE CAN I FIND THE WEBCAM? IS THERE A BUTTON ON THE LAPTOP KEYBOARD THAT I SHOOT? IF SO WHAT SYMBOL IS IT ON THE KEYBOARD? THANK YOU APPRECIATE ALL THE HELP

    Read the help files for HP or HP support or HP forums site

    The webcam is provided by HP, not MS or win7

  • HARD drive is full, but only be able to view the OS, applications and data. Need help to find out what else takes place.

    I am running a Compaq nx 7400 and Windows Vista Business edition. My HARD drive is 66.6 GB. PROG 7.63 files. Windows 9.61. 19.3 user data. 36.54 total.
    But my HARD disk is apparently full of 98.7 percent. Where the other GB 30.1? Recycle bin isempty and deleted temporary files.
    I want to upgrade to Win 7, but do not have the space.
    Can someone help me, please!

    Hello Falcodriver,

    Thanks for the return of the answer!  I have included a link below with a similar question.  It could be the system restore or backups that use the extra space.  I hope this link helps!

    Microsoft Answers:

    http://answers.Microsoft.com/en-us/Windows/Forum/windows_vista-hardware/hard-drive-is-full-and-i-Don ' t-know-why/83b620da-c029-4a1b-81cd-0b166b008162

    Thank you

  • Create dllmain for labview built dll

    I have a lot of labview code I want to turn it into a DLL. The dll will require some global state initialization after cleaning on process_attach and process_detach. If I was building the C code DLL, that I would create a DLLMain function to take care of this, however when I look in the properties of specifications of generation of a DLL in the LabVIEW Project Explorer, I can't find an option to set my initialsation code and stop. Note that I use LabVIEW 8.6.

    On another note, in looking at the docs for the Call library function node we're talking reminders for the reserve, cancel and abort. What does mean to 'reserve' and 'Cancel '? The description suggests that these reminders can be used for initialization and cleanup but I see not how make use of this in a context where my labview built DLL could be described as some other environment (e.g. an exe written in C).

    I'm still fairly new to LabVIEW so I apologize if I missed something obvious.

    DLLMain is VERY limited in what it can do without causing a charger global potentional lock in Windows System. The execution of LabVIEW VIs is something requiring an infrastructure that is not safe for DLLMain initialization already almost 100%. So there is no way that I can see, LabVIEW could allow you to run a specific VI at load time. And change DLLMain yourself isn't an option either, given that LabVIEW that creates on the fly for each DLL and the code is quite tricky.

    What is the problem about the design of your DLL in such a way that the user must call an initialization function explicitly before using other features in it? After all there is no global state in a LabVIEW DLL, except by functions that are loaded into memory and remain in memory for as long as you want to maintain global state. Once function initialized global X() a memory of leaves before the Y() function that references global was loaded into memory, the enitre a global state is lost and reset to the default state when loading function Y().

  • Is there a way to make an EXE LabVIEW built on Windows XP on Windows 7?

    I have a request that I build (LabVIEW 8.6) on Windows XP, that installs and works fine on other XP machines.  However, after installing it on a Windows 7 computer, I get an error stating that "The procedure entry point CsrNewThread could not be found in the dynamic link library ntdll.dll".  When I look at ntdll.dll (in C:\Windows\System32) with a tool dependency walker on XP, I see the CsrNewThread function listed, but its function is missing from the same DLL named on Windows 7.  So I guess that somewhere along the evolutionary line Windows this function has been removed from ntdll.dll.  My first instinct was to try overwirting ntdll.dll on the Windows 7 machine with one copied from my Windows XP computer.  However, our system administrator only gave me permission to replace this file on the Windows 7 machine.  I could ask him to give me this permission, but I'm not sure it's the best way to go anyway because the other programs in Windows 7 can use ntdll.dll.  I tried to copy the WIndows XP version of ntdll.dll in the local folder on the Windows 7 machine containing my LabVIEW application, but this has not fixed the problem.  And when I look at my application in the dependency walker tool, I see that he is always looking in the ntdll.dll file in the WIndows\System32 folder and not in my local folder.  Yes, is there a way to make an EXE LabVIEW built on Windows XP on Windows 7?  Or I have to do a version for Windows XP and one for Windows 7?  Still, I am using LabVIEW 8.6.

    Thank you

    Keep in mind that LabVIEW 8.6 is not officially supported under Windows 7.  You may want to consider switching to less than LV2009.

  • multi thread dll

    Hello

    I have a labview application where I need to use a function built user centroiding.   I have compiled this usrCentroid.c stand-alone function in a dll, using a script:

    GCC - c-o %1.o %1.c
    GCC-shared o %1.dll %1.o

    the GCC is a free version of MinGW.

    I then used the CIN to call this dll, everything works.  However, when I tried to use two of the dll at the same time (value becomes too), I couldn't get the parallel execution in time. There are always two times longer than a single call to the dll.

    an engineer OR tried on his computer to quad processor (I don't have a processor doubles) with timed loop, he gave the same result.  He suggseted me to create a multithreaded for usrCentroid.c dll.

    Is anyone out there built for multithreaded dll?  I found no option to gcc generate the multithreaded dll.

    I tried to have two functions completely different (usrCentroid1.c and usrCentroid2.c, nothing in common) and built two DLLs.  I asked the engineer OR to try again on his quad CPU.  Calling these two DLLs, always give the same result as before.

    However, he said that if he used the IMAQCentroid of Labview function with the same parallel pattern, he had simultaneously as a single call to the dll.

    is there something here I need to take into account for the built dll user?

    appreciated any suggestion or advice.

    Xiaofeng


  • can I create a DLL file for labview that has DLL library with inside?

    Hello everyone,

    I am developing an application for the cards PCI devicenet in labview (beginner to labview) environment.  Is there a DLL file for the PCI card from the provider. But it's too complicated for a beginner to call each function in the DLL of labview. Therefore, I'm trying to re - use a VC ++ program (working properly) that calls some sellers DLL library functions.    To do this, I created the DLL file which includes all headers and libraries the provider DLL, as indicated in the attached figure. But I couln can't see the effect on the device. is it possible to create a DLL file for labview that has DLL library with inside? If this is not the case, how can I implement the program shown in figure?

    I would like to wish a huge as to advance.

    It is not something I have a lot of experience in so I don't know all the details of the restrictions or requirements etc - but it is certainly possible to create wrappers for the dll and then use them in LabVIEW - this is sometimes necessary to convert some native types/data structures in C/C++ into something that you can switch to your other DLL LabVIEW.

    There is a link here: http://digital.ni.com/public.nsf/allkb/06ECDC689DDA0F3D862574440074CD95

  • LabVIEW can create DLLs 'returning '?

    Can LabVIEW create reentrant DLLs; I mean, there a dll that maintains state information between calls? If so, how are you implementing it?

    Thank you

    Maintain state information can be done through a registry to offset the.  This also works in a LabVIEW DLL.

    Make sure that the DLL is not unloaded between the function of other calls he will lose his memory.

  • Can I make an application multi-folio for Chinese users?

    As the realization of content is not available for users in mainland China, I can only design unique edition apps for users in China (since simple editing, everything is in the application package). I can do an application multi-folio for Chinese users (which means users do not have to download it from Adobe servers, everything is wrapped inside the application)?

    Thank you!!!

    Folio multi applications require content to download, so the answer is no.

    Bob

  • Clarification of the idiom of the neck/body in multi threaded applications

    Hello

    As some DBXML classes use the handle body language (idiom neck/body in some docs), could someone please clarify the consequences of that in a multi thread as a web container application?

    For the people of Java 100%, like me, it is known in the Java world as "programming to interfaces", or model of bridge; who is considered a good practice.

    Let's take an example. The XmlQueryContext class is not thread-safe, but it has a copy constructor. Imagine that your web application has a XmlQueryContext, that we never use in a query, but that prepares us can only be fully copied in further discussions. Is it safe to instantiate the various XmlQueryContexts again using the copy constructor, then, in various news feeds and use them at the same time?

    Thank you
    Koen

    PS Ce I'm wondering really here, is if someone could translate it please the following to talk about Java:

    A copy constructor is provided for this class. The class is implemented by using a language of the body handle. When a handle is copied both handles retain a reference to the same body.

    As a user of Java, you don't have to worry about how the C++ copy constructors behave. In the Java API if there is a copy constructor for the object, then the copy constructor copies all the data of the original object in a new object (XmlContainer is the only exception to this rule, generally do not use this constructor to copy at all). So basically, what you intend to do will work.

    Lauren Foutz

  • Need help with implementing DLL based on LabVIEW below call Lib

    Here is the list of C functions in the doc that I have, but I don't get the right result.

    I need help to understand how these features and how to configure it in LabVIEW

    Parameters

    voltType
    [in] Specifies a voltage detector to get the value of. There may be flags
    VCORE (1<>
    V25 (1<>
    V33 (1<>
    V50 (1<>
    V120 (1<>
    VSB (1<>
    VBAT (1<>
    VN50 (1<>
    VN120 (1<>
    ATV (1<>
    retval
    [out] Points to a variable in which this function returns the voltage in volts.
    Typesupport
    [out]
    If the value is specified as a (non-NULL) pointer to a variable, it will return the types of sensors available in indicators at the level of the ILO-ORed
    Return value
    TRUE (1) indicates a success; FALSE (0) indicates a failure.
    Remarks
    Call the function first with a typesupport non-NULL of the sensors available fan and a subsequent call to get the required voltage.

    Thanks to all...!

    I solved this problem.

    There was a problem in the configuration of the VoltType. We have a cluster of bits.

    Here is the screenshot.

  • Need help on calculation of complex math in labview

    I need help in being pointed in the right direction.  I have an old piece of lab equipment that I have linked to the labview.  In order to send commands to the hardware, I have to calculate a checksum.  The checksum algorithm requires me to take alphanumeric, convert them to binary, perform a binary addition, perform an Xor, hide some numbers and convert the resulting binary string to an ascii character.  LabVIEW has the capabilities to do it on its own, or should I look for to connect to something like an external dll?

    I have Visual Studio 2008 and some previous experience in VB, so I think I could write a program that would make the calculation, but don't really know exactly what kind of project (dll, etc.) is preferable.  Are there specific for the dll parameters so that labview can use it.  I see an example for C++ to Visual Studio 2005, but that's as close as I can get.  I only know VB, c#, or C++

    Can someone tell me please in the right direction?

    Tron

    You essentially have some quarters of logical work and ANDS.

    Check version 2.

    /Y

Maybe you are looking for

  • Display brightness with EliteBook 8460p function keys

    I'm having the same problem with my brand new 8460 p which was much discussed here: the brightness of the screen cannot be adjusted using the function (fn + F keys) then under Windows. In other threads, the problem has been resolved by installing the

  • Qosmio G30 - S-video and undetectable video anywhere

    Try different cords of different cameras, video and software of WMM for Virtual Dub - nothing. What controls the selection of the source? How can I test it?

  • F375: Software &amp; Drivers for Windows 10 / all-in-one printers, HP Deskjet F375

    When drivers and software will be available for the all-in-one printer HP Deskjet F375 for Windows 10? Current software and drivers for F375 on HP downloads (updated August 28, 2014) are for Windows 8 will not install on Windows 10. HP Solution Cente

  • With the help of multiple AAA servers

    Is it possible to run aaa authentication/authorization for my "auth-proxy" to a single RADIUS server function and send all other authentication/authorization applications to a different server of GANYMEDE +?

  • update conflict mouse screen readers

    I have recently downloaded a driver for my wireless arc mouse. When you play a windows game 7, the screen flashes but nothing happens. Can I uninstall and fall back to my old driver? Thank you