Is dll threading treated the same as vi threading?

I noticed by default my dll built by Visual C++ is set to run in the gui interface subsystem which I assume is equivalent to labview's gui interface thread. Yes?
I further assume that calling into the dll from any vi running in any thread is equivalent to calling a subroutine vi set to run in the gui interface thread. Yes?
If yes and yes, and since labview cannot suspend a subroutine vi or the dll, the gui interface thread would be 100% utilized by the call. It would therefore seem, that all other operations occurring in the gui interface thread would be suspended until the call completes, and further more if the dll call is made through a subroutine sub-vi set to run in the caller's thread, then the caller's
thread would also be suspended. Yes?
Hence, you could weave yourself into a situation where all other threads are awaiting the execution of gui interface thread. And that then leads to the question of the order in which execution will occur once qued.
Typically, my threading is separated in my top level vis and the lower level vis are set to run in the caller's thread. But in migrating from LV4.x to LV6i, I never checked my API call dlls execution subsystems, which if the above is correct, may adversely affect my presumed threading...
So... Assuming the above is true and to avoid it, can I create a dll that runs in the caller's thread, or must the dll's execution thread be specifically set when it is built? More generally, is there a way to avoid this short of insuring that the threads do not compete for the same code resources?
Thanks,
Kind Regards,
Eric
PS: it might be kinda nice to see the threading identifiable (connections highlighted in various colors
for example) in the vi hierarchy window...

My info is marked with ***s.
> Assuming I specify all dll calls as re-entrant, the number of
> simultaneous dll calls that can be made from within labVIEW is limited
> to the number of threads. Specifically, once the dll has control of
> the thread, nothing else in labVIEW can execute in that thread until
> the dll call completes. Yes?
>
A DLL doesn't normally multitask with other code, but there are
situations where it does, such as when the DLL decides to process or
pump messages. The above assumption is pretty accurate, but there are
things a DLL could do that would void them.
> If a thread ID were attached to information passed to a labVIEW
> library function, and that function retained the information for
> labVIEW, then labVIEW in theory could request the information from the
> function when the dll call completed. The thread Id would uniguely
> identify the data because only one dll call can be made with that
> thread from within labVIEW and of course labVIEW knows which thread is
> making the call. Yes?
>
I'm not sure I understand where this is going. Any DLL is free to pay
attention to the thread ID, but there is no guarantee that the same
thread will be used for the VI's next execution, or for the DLL's next
execution. Information can be stored by the DLL using the threadID, but
LV doesn't know anything about the information or even which thread
executed the DLL once it returns.
Perhaps this info will help out. LV has two ways of executing a DLL
call. If the DLL call is marked as reentrant, then it will be called in
the current thread. It is then the DLL's responsibility to protect any
data or code section that cannot have multiple threads in it simultaneously.
For compatibility, and to make it easy to protect a DLL call, you can
mark it as non-reentrant. This will cause the DLL to be swapped over to
the UI thread so that any other thread trying to call the code at the
same time will be blocked, and the DLL call will be protected.
If you have other questions, ask them.
Greg McKaskle

Similar Messages

  • Is it possible to call a function with the same name from 2 different dll's at the same time.

    I'm trying to call a function ( F ) form 2 different libraries ( A.dll and B.dll ) at the same time. The first lib loaded determines the function F. A->F and B->F have same interface and name but different implementation.

    Hi,
    I tried it with two dll's, both with the same interface, and at the same
    time, in the same VI. The popups even appear at the same time.
    But now I understand the problem... Both dll's are created by LabVIEW! If
    they are not (or one is not, and the other is), this is no problem.
    And VI's in memory cannot have the same name. LabVIEW doesn't care if VI's
    are in a dll or not.
    This might not help, but if you want to make some sort of "plug in" system,
    you might consider using llb's. By loading VI's dynamically, you can select
    the path from which they are loaded. You must unload (close all references)
    one before the loading the other, or the same problem will occur. If you go
    this way, I consider a different approach. Make on
    e library (or even a dll)
    that has the interface you like, this is the "loader". Now make several
    "plug in"'s, with the same interfaces. The name of each function in a plug
    in is a concatenation of the library name and the function name. The loader
    has one extra function, that loads (and unloads, when done) references to
    all desired libraries to use (the names of the functions can be figured out
    easily). All that the loader functions do is dynamically call the library
    functions. You can use a call by reference node for this (you can use the
    connector pane or the loader vi, since the interface must be the same!).
    If you go this way, I guess the loader library can be converted to a dll...
    Hope this helps.
    Wiebe.
    "rsam" wrote in message
    news:[email protected]..
    > Thx Wiebe,
    >
    > did you load both dll at the same time? For example in 1 vi. Somehow
    > the first loaded function keeps to overrule the second. Notice that
    > the interface is
    exactly the same.
    >
    > I loaded 2 dll created in Labview with results described above.
    >
    > Regards Ruud

  • All labeled DLLs broken at the same time

    I have 3 different sources for dll files that I have been using in LV for many years.  Something odd happened last week and the program can no longer find any of the dll files, although I manually verified that they have not moved.  Was there an automatic update to LV that posted, or has anybody else had the same issue?  Unfortunately, I can not post code.  
    Thank you!

    hi bpackard5,
    there have been no "automatic updates" to LabVIEW in the past week that could account for DLLs not showing up that I am aware of. Have there been any changes to your target computer at all? Any more information you could provide about your setup, your program or your computer enviroment would be greatly appreciated.

  • Force DLLs to tun in the same thread (expect the UI Thread)

    Hi,
    I want that three different DLLs run in the same thread  but this thread must not be the "UI Thread". I there a way to force them to do so?
    Best regards
    Solved!
    Go to Solution.

    Jarrod S. wrote:
    Do the DLL calls really have to execute in the same thread? Or is it just required that they not execute at the same time? In the latter case, you could consider using a semaphore to protect your DLL calls, or perhaps putting all the DLL calls into a single subVI with a case structure to decide which call to make. This second option might become more complicated if all the calls have different sets of inputs or outputs.
    Using another Execution System other than the UI Thread won't work, because those Execution Systems each get 4-8 threads to run with.
    Ho about... 
    Putting all of the calls into an Action Engine configured to run in "other1" (for example) and then use "threadconfig" to configure that for only one thread.
    Write a wrapper for each call to the AE and ....
    Done?
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Does a reentrant dll call monopolize the calling thread?

    If I understand thing correctly, threading for a dll call is the same as threading for a vi whose execution priority is set to subroutine.
    To review threading in subvis:
    (1) the thread in which a subroutine-execution-priorty-vi call is made is monopolized by the subroutine-execution-priorty-vi since labview cannot time slice the thread.
    (2) if the subroutine-execution-priority-vi is not reentrant, then other threads that call the vi may be suspended because they are competing for the same code resource.
    (3) if the subroutine-execution-priority-vi is reentrant, then other threads may call the vi simultaneously. However, within any particular thread the vi must complete because of point (1).
    In
    sum, the OS timeslices between the threads, and labVIEW timeslices within the threads. If a vi's execution priority is set to subroutine, then the thread under which it is running is monopolized by the vi. Yes?
    A reentrant dll call would be equivalent to a reentrant subvi call in which the subvi's execution priority is set to subroutine. Yes?
    If the above is correct then this should also be correct:
    Using an API call to return the thread ID, you could use the the thread ID at the front and back side of a dll call, as well as in a message library function callable from a dll, to theoretically message labVIEW upon the dll return. The message would be uniquely identifiable because a dll call cannot be superceded by another dll call from within the same thread. Yes?
    I'm not saying that it would be particularly efficient to do so, only that it could be done. And depending on the messaging, it could be a useful option in the dll call configuration dialog box.
    In consider
    ation of "magic",
    Kind Regards,
    Eric

    Eric,
    I'm not sure I understand exactlly what you are trying to do here.
    If you want LV to react to a dll error, why don't you just pass a return
    code that's not zero? Then, back in LV, read the return code. If it's not
    zero, create an error, and pass this to the rest of the code. The rest of
    the code is (or should, following good programming practise) has an error
    in, and the code will not execute if the input error is TRUE. It does not
    even have to be the return code, it could be any input value. The input
    values can be changed in the code, and the modified value is returnd to
    LabVIEW.
    If you want to generate an error, and put it into a buffer to be read later
    on in LV, you'll have to synchronise the code. This is the consequence for a
    construction like this, and is the same for several windows API's
    (GetLastError, etc.). the buffer will stay in memory, untill all instances
    of the dll are released from LV memory.
    BTW: A dll could create another thread. This thread can run on the
    background, like the good old TRS's in dos. (A thread like this could even
    call a LabVIEW VI that is build in a dll, just like any other api.)
    BTW: A thread created by a dll can be made to be automatically released when
    the thread is detatched, or when the process is detached. This is important,
    because LV will crash if the dll is removed from memory, but the thread is
    not stopped properly.
    Regards,
    Wiebe.
    "Eric6756" wrote in message
    news:[email protected]...
    > Greg,
    >
    > As I think I lost you in the point of this line of questions, let me
    > back up.
    >
    > A couple of week ago I asked the following question, "Is there a
    > labVIEW library call that can be made from a dll to tell labVIEW to
    > abort the calling vi thread?" To that question you made the following
    > statement:
    >
    > "... and I doubt that there is a function to do that from a DLL as the
    > DLL could be arbitrarily deep down the stack and the function called
    > would have to magically find the VI that it wants to abort. And don't
    > forget that DLLs can be called by multiple VIs at the same time."
    >
    > You seem to be saying here that what I'm asking for is not possible.
    > And having thought about this for a while, I didn't understand why
    > not.
    >
    > For the moment I'm going to ignore the caveat you just put into the
    > dll calling presumptions I've made and assume the dll is going to
    > execute synchronously within a thread. As the original question
    > suggests, the objective here is to message labVIEW from a dll to
    > provide the same functionallity as a CIN, namely return an error code
    > to labVIEW from a dll.
    >
    > A library function could do this as follows:
    >
    > First, the library function would have two modes; set error, and
    > return error
    >
    > (1) set error:
    >
    > 1.1 get the set error caller thread ID from API
    > 1.2 get the passed in error
    > 1.3 store the error and associated thread ID locally
    >
    > (2) return error
    > 2.1 get return error caller thread ID from API
    > 2.2 locate the error, if any, associated with thread ID
    > 2.3 return the error and clear it locally
    >
    > Now, if a dll encountered an error that it wanted labview to deal
    > with, it would call the error function to set the error code. When
    > the dll call returns control to labVIEW, labVIEW could call the
    > function to return the error. This of course works only if the dll
    > call is synchronous within a thread. Obviously, if the dll releases
    > the thread before it returns, then more than one dll call can be made
    > from the thread and the presumption that an error could be uniquely
    > associated with a thread is itself an error.
    >
    > Having looked at your reply again, I think though your answering a
    > different question than I asked. I just wanted a function to message
    > labVIEW to abort the vi chain, I don't want to abort a vi chain from
    > within the dll. It is a feature of CIN calls which I wanted in dll
    > calls.
    >
    > That a dll call may not be synchronous within a thread throws a wrench
    > in the works. Apparently I've just chased down a dead end.
    >
    > Hey, but thanks for the wrench...
    > Kind Regards,
    > Eric

  • Null and empty string not being the same in object?

    Hello,
    I know that null and empty string are interpreted the same in oracle.
    However I discovered the strange behaviour concerning user defined objects:
    create or replace
    TYPE object AS OBJECT (
    value VARCHAR2(2000)
    declare
    xml xmltype;
    obj object;
    begin
    obj := object('abcd');
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    obj.value := '';
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    obj.value := null;
    xml := xmltype(obj);
    dbms_output.put_line(xml.getStringVal());
    end;
    When creating xml from object, all not-null fields are transformed into xml tag.
    I supposed that obj.value being either '' or null will lead to the same result.
    However this is output from Oracle 9i:
    <OBJECT_ID><VALUE>abcd</VALUE></OBJECT_ID>
    <OBJECT_ID><VALUE></VALUE></OBJECT_ID>
    <OBJECT_ID/>
    Oracle 10g behaves as expected:
    <OBJECT><VALUE>abcd</VALUE></OBJECT>
    <OBJECT/>
    <OBJECT/>
    However Oracle 9i behaviour leads me to the conclusion that oracle
    must somehow distinguish between empty string and null in user defined objects...
    Can someone clarify this behaviour?
    Thus is it possible to test if object's field is empty or null?

    However Oracle 9i behaviour leads me to the conclusion that oracle
    must somehow distinguish between empty string and null in user defined objects...
    Can someone clarify this behaviour?
    Thus is it possible to test if object's field is empty or null?A lot of "fixes" were done, relating to XML in 10g and the XML functionality of 9i was known to be buggy.
    I think you can safely assume that null and empty strings are treated the same by Oracle regardless. If you're using anything less than 10g, it's not supported any more anyway, so upgrade. Don't rely on any assumptions that may appear due to bugs.

  • Multiple copies of the same image in Data, Originals and Modified within iP

    My question is a simple one. Do these many copies (which, as far as I can tell, are identical) of photos make the library take up far more space than it should?
    I'm rather new to Mac, so I don't know how identical files are handled.

    iPhoto always preserves your Original file. It's built-in to the app is a core feature of it. In this is coheres to the best principles of Digital Asset Management, where your original is treated the same way as a film photographer would treat his negative. Having an option to overwrite the original would make it a different app, and there are already loads of apps out there that will do that - any image editor for instance - so what would be the point of that.
    If space is an issue you can run the Library from an external disk:
    1. Quit iPhoto
    2. Copy the iPhoto Library Folder as an entity from your Pictures Folder to the External Disk.
    3. Hold down the option (or alt) key while launching iPhoto. From the resulting menu select 'Choose Library' and navigate to the new location. From that point on this will be the default location of your library.
    4. Test the library and when you're sure all is well, trash the one on your internal HD to free up space.
    Or if you really don't want the feature, it's always possible to use another application for managing your photos.
    Regards
    TD

  • I can't run LR5 and EOS utility at the same time

    I'm running Mac OS 10.9.5, LR5.7 & Eos Utility 3.
    I can't run LR and Eos3 at the same time. Eos just crashes and have to force quit Eos.
    Any tips anyone?
    Do I have to downgrade to Eos2. Not a problem really I suppose.

    LR supports tethering using a Canon DLL and EOS Utility probably also supports tethering or at least uses something from a similar Canon DLL.  You probably cannot have two different versions of that DLL loaded at the same time, so it makes sense there are problems.

  • Can't run wiki and web services at the same time?

    I'm a newbie with Lion Server, but I've been running several web sites successfully for about 6 months.  I'm up to Server 10.7.4.
    I've been trying ever since the first installation of Server to get the wiki service running.  I had absolutely no luck until I turned OFF the web service (always got the "URL does not exist" error when I tried to create a group wiki from inside the Server app).  With the web service off, it all starts up fine and I created my first wiki (woohoo).  Turning web service back on kills access to the wiki.  I don't find reference to this in any of the dicussions, and especially not in Apple's documentation.
    Are the Wiki and Web services mutually exclusive?  Or is there a way around this?
    I'm using Dyndns to provide me with sub-domains to use, and I've dedicated one of them to the wiki service.  Traffic comes in on port 8080, where my web sites are on port 80.
    Thanks for any pointers...
    edbok

    LR supports tethering using a Canon DLL and EOS Utility probably also supports tethering or at least uses something from a similar Canon DLL.  You probably cannot have two different versions of that DLL loaded at the same time, so it makes sense there are problems.

  • If I buy a 4s online, is it going to be considered the same as bought directly from apple retail stores?

    I was trying to buy an unlocked 4s from an apple retail store directly, but it is too hard, the supply is way too short than the need.
    Therefore, I am thinking to order one from the apple online store.
    My question is,
    if I get the unlocked 4s online, is it going to be treated the same as bought from the apple retail stores?
    I mean such as warranty or any services I can ask for when buying from the stores.
    I do not want to hear something like " your phone was not purchased from one of our retail stores, so we are unable to do anything for it. "
    Any one knows? I appreciate it.

    No difference at all.  I recently had my iPhone 4S (purchased from the Apple Online Store) replaced at my local Apple retai.store with no problems.  However, if you plan to use the phone in another country,
    "IMPORTANT RESTRICTION
    Apple may restrict warranty service to the country where Apple or its Authorized Distributors originally sold the Apple Product. "
    See http://images.apple.com/legal/warranty/docs/iPhone_4_warranty.pdf

  • How is it possible to make sure that LV uses the same thread for several threadsafe DLL calls?

    Hello,
    i have a thread safe DLL and most functions are called from serveral threads from the LV apllication without problems.
    In case of an error i have to call an error handler function in this DLL (like WinAPI: GetLastError()) from the same thread which has called the function that failed before.
    I can't use the user interface execution because some functions need a long execution time and i don't want to balk the user interface.
    All other executions than the user interface execution have more than one thread and in most cases the DLL function calls were executed from different threads - so the error handling doesn't work...
    Any idea?
    Thanks for your help!

    Hmmm....
    How about wrapping all of your dll calls in a single VI (or an Action Engine ) and make sure the VI's thread is NOT set for "Same as caller".
    "Threadconfig.vi" (sp?) will also let you dictate the number of threads associated with an execution system. Set your target thread for "1".
    Not sure on the above.
    Please correct me if this is wrong!
    Ben
    Message Edited by Ben on 07-19-2007 08:26 AM
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

  • Multiple classes accessing the same DLL???

    This behaviour is completely unacceptable.
    Let's visualise my app:
    There a 2 java classes:
         ClassA:
              public String[] getPaths(){
                   return getNativePaths();
              public native String[] getNativePaths();
              static{
                   System.loadLibrary("mylib");
              }     ClassB:
              public void setPaths(String[] paths){
                   setNativePaths(paths);
              public native void setNativePaths(String[] paths);
              static{
                   System.loadLibrary("mylib");
              }     MainClass:
              public void testA(){
                   ClassB clsB=new ClassB();
                   String paths[]={"c:\\test.txt"};
                   clsB.setPaths(paths);
              public void testB(){
                   ClassA clsA=new ClassA();
                   String paths[]=clsA.getPaths();
              public void testC(){
                   ClassA clsA=new ClassA();
                   String[] paths=clsA.getPaths();
                   clsA=null;
                   ClassB clsB=new ClassB();
                   clsB.setPaths(paths);
              }Method testA and testB in MainClass don't pose any problems, they work fine. :)
    But when calling testC, I get this:
    java.lang.UnsatisfiedLinkError: no mylib in java.library.path
         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1403)
         at java.lang.Runtime.loadLibrary0(Runtime.java:788)
         at java.lang.System.loadLibrary(System.java:832)
         ...ClassA and ClassB both work good if used separately (another thread). But if we call one after another (same thread), an exception is thrown.
    So, what's the problem here?
    Is it the return of a string array?

    1 remark:
    If I do this:
        ClassA clsA=new ClassA();
        ClassB clsB=new ClassB();
        clsB.setPaths(clsA.getPaths());This works, but if you call the dll again after this, you'll get the same exception over and over again.
    I think it has something to do with the release of strings (cause there isn't any).
    My native code that returns an array of Strings:
        jobjectArray strArray=null;
        strArray=env->NewObjectArray(nSize,env->FindClass("java/lang/String"),env->NewStringUTF(""));
        // loop
        env->SetObjectArrayElement(strArray,nCount,env->NewStringUTF(dlg->GetNextPathName(pos)));
        nCount++;
        return strArray;

  • Prompted to upgrade iTunes on computer. Won't let me and get error message MSVVR80.dll not found. Attempted to reinstall, won't let me. Can you have iTunes and iCloud on the same computer?

    Prompted to upgrade iTunes on computer. Won't let me and get error message MSVVR80.dll not found. Attempted to reinstall, won't let me. Can you have iTunes and iCloud on the same computer?

    Try following the instructions of tt2 in https://discussions.apple.com/thread/5822086

  • I have the same problem, MSVCR80.dll, I uninstalled, but can't "install", get message "Service "Apple Mobile Device" failed to start. Verify that you have sufficient priveges to start services. Nothing works? HELP !!!

    I have the same problem, MSVCR80.dll.  I "uninstalled", but can't "install" , get error message "Service "apple mobile device" failed to start. Verify that you have privleges to start service.  No option works.  HELP !!!! I'm NOT  a computer geek !

    Follow the instructions of tt2 in https://discussions.apple.com/thread/5822086 and note especially to run as admin.

  • My itunes will not! is giving me error7(windows error 126) and is stilling me MSVCR80.dll is missing and i tried downloading itunes like 6 times and is saying the same thing. Please help! i need to sync my kids ipads and ipods thank you!

    my itunes will not open! is giving me error7(windows error 126) and is stilling me MSVCR80.dll is missing and i tried downloading itunes like 6 times and is saying the same thing. Please help! i need to sync my kids ipads and ipods
    thank you!

    Follow the instructions of tt2 given in https://discussions.apple.com/thread/5822086

Maybe you are looking for

  • How to delete the SC in the SRM by backend?

    Hi Experts. We've faced a huge trouble. We're using the BBP_EXTREQ_TRANSFER program to transfer PR from r/3 backend to SRM. Its works fine. However when we need unrelease all items from the RC in the backend the data aren't not send to SRM. The SC st

  • How to increase the column size of Alv tbale

    Hi All, I created an Alv table to display the content of my database table. In one of the column the entire data from my database are not displayed the last few characters are missing. The data type for that column in the database is char. Can any on

  • Conversion of hierarchy structure to flat structure

    Hi Gurus, I am mapping a multi node XML structure to flat structure to create the JDBC statements to Oracle database. I think JDBC DML statement can have only flat structure. Now how to convert the incoming multi node xml file to several flat structu

  • Best settings for editing MP4 videos in Pre9?

    Hello! I have some MP4 video's that I wish to edit. When I edit them and try and save them, I am struggling to find the best settings to use. If I try making them Pal DVD widescreen the motion is very jerky. If I use H264 wide screen the file is enor

  • Internal disk space is low

    I'm getting this error message on a 1TB time capsule that is connected to an imac with about 700gb on it. I can't find anything that tells me what to do to fix this other than delete everything on the capsule and start again. I assumed the time machi