Call a DLL in TestStand by reference

All,

I developed a DLL that control a USB based power. The call of the dll works from TestStand 4.1 most of the time. What I think is happening, is that whenever I call the dll in my main sequence of the file as well as other files in sequence, as several instances of the dll is loaded.

Part of the init of food must pass back a SESSION number that is used in subsequent calls to the dll. I store as a global variable in TestStand and pass around sequence that never he needs.

How can I load the DLL at the beginning of the sequence and PASS a reference (handle) to all other calls to the dll?

Thanks in advance

Carmine

Doug,

Thanks for your help. I found a UnLoadModules() in one of the child seq that I missed. Unless I missed all the others, I think this should be resolved.

Carmine

Tags: NI Software

Similar Questions

  • How to get the result of the test of CVI DLLs in teststand!

    I write a driver dll to test a source, I want to get the tension of world SERVERS (the instrument of the RS) and I used to call DLLs that written by CVI, teststand

    My question is what is the best way I can get the result of the test and show the user to teststand. the code below is fair? When I used to call this dll document, teststand

    "" I just get the result by setting in TS.this is a good meathod, and what should you do in teststand, I put the "outputVoltageV" point to an object?

    /*===========================================================================*/
    / * Function: read voltage/current output * /.
    / * End: this function returns the output and actual output voltage * /.
    / * current instrument.                                      */
    /*===========================================================================*/
    ViStatus _VI_FUNC rsngsm_datReadOutput (ViSession instrSession,
    ViPReal64 outputVoltageV, ViPReal64 outputCurrentA, ViPBoolean statusPeakCurrent)
    {
    ViStatus rsngsm_status = VI_SUCCESS;
    Bruno buf [BUFFER_SIZE];
    ViInt32 retCnt;
       
    FMT (buf, "%s<>
    If ((rsngsm_status = viWrite (instrSession, buf, NumFmtdBytes (), & retCnt))<>
    Return rsngsm_status;
           
    If ((rsngsm_status = viRead (instrSession, buf, 50, & retCnt))<>
    Return rsngsm_status;
    If (Scan (buf, "%s > %f [p2];")) %f [p2]; %i [b2] ", outputVoltageV, outputCurrentA, statusPeakCurrent). = 3)
    Return rsngsm_status;
           
    Return rsngsm_status;
    }

    sean_tan,

    Yes, you just pass a value of digital TestStand (e.g.; locals.number).

    If you use the adapter of the ICB, it might make more sense that you can use the Flexible DLL adapter for this type of function, that you do not use the standard settings of tTestData and tTestError. While TestStand will correctly recognize the function prototype, you want to make sure you that include the type library of your function Panel (you will need to create one if you have not already done so) in settings target of LabWindows / CVI-> type library.

    I hope this helps.

    -Jack

  • Two parallel executions, calling a DLL function

    Hello

    Since this test takes about 6 hours to test my USE, I plan to use the parallel model to test 2 UUT at the same time in parallel.

    I implement the test code as a DLL of CVI.

    However, to my surprise, it seems that the steps that call a DLL function actually traveled in one series, not in parallel:

    Test 2 power outlets if one enters and executes a DLL works, the other waits for the first to complete its operation and return. While the other runs on the same copy of the DLL, so that the DLL global variables are actually shared between executions.

    So if a DLL will take 5 minutes to complete, two executions in the running at the same time take 10 minutes. This isn't a running in parallel in every way.

    What I want and expect also TestStand, was to completely isolate the copies of these two executions DLL such as test two casings could run at the same time the same DLL function by arbitrary executiong their copy of the function, completely isolated from one another.

    So they separated globals, discussions, etc., and two parallel jacks take 5 minutes to run a step, instead of 10.

    Such a scenario is possible?

    If not, how can I use my test in parallel (in truly parallel) when the use of 2-socket test?

    (1) Yes, he'll call the multiple executions in TestStand calling into the same dll in memory the same copy of this DLL. Thus dll called in this way must be thread-safe (that is written in a way that is safe for multiple threads running the code at the same time). This means usually avoiding the use of global variables among other things. Instead, you can store the thread shows in local variables within your sequence and pass it in the dll as a parameter as needed. Keep in mind all the DLLs your dll calls must also be thread-safe or you need to synchronize calls in other DLLs with locks or other synchronization primitives.

    1 (b) even if your dll are not thread-safe, you might still be able to get some benefits from parallel execution using the type of automatic planning step and split your sequence in independent sections, which can be performed in an order any. What it will do is allow you to run Test a socket A and B Test to another socket in parallel, and then once they are then perhaps test B will take place on one and test one run on the other. In this way, as long as each test is independent of the other you can safely run them in parallel at the same time even if it is not possible to run the same test in parallel at the same time (that is, if you can not run test on two Sockets at the same time, you might still be able to get an advantage of parallelism by running the Test B in one take during the tests in the other. See the online help for the type of step in autoscheduling for more details).

    (2) taken executions (and all executions of TestStand really) are threads separated within the same process. Since they are in the same process, the global variables in the dll are essentially shared between them. TestStand Station globals are also shared between them. TestStand Globals file, however, are not shared between runs (each run gets its own copy) unless you enable the setting in the movie file properties dialog box.

    (3) course, using index as a way to distinguish data access are perfectly valid. Just be careful that what each thread does not affect data that other threads have access. For example, if you have a global network with 2 elements, one for each grip test, you can use safely the decision-making of index in the table and in this way are not sharing data between threads even if you use a global variable, but the table should be made from the outset before start running threads , or it must be synchronized in some way, otherwise it is possible to have a thread tries to access the data, while the other thread is created. Basically, you need to make sure that if you use global data which the creation/deletion, modification and access in a thread does not affect the global data that the other thread use anyway in or we must protect these creation/deletion, modification and access to global data with locks, mutex or critical sections.

    Hope this helps,

    -Doug

  • Loading of a DLL on RT: Missing Export "DecodePointer" "Kernel32.dll" and 7 error when calling the DLL

    Hi, I recently changed to Visual Studio 2010 and Windows 7 64-bit.

    I have an existing Office RT system running RT 2009.  This system calls a DLL that I already built using Visual Studio .net 2003 and Windows XP.

    Since I've recompiled the DLL I get an error 7 file not found error when I call the RT DLL, even if I simply replaced the old DLL with a new one in the file system so the path has not changed.

    I also noticed that the message on the screen connected to the RT system during startup:

    "achieveworldpeace.dll" load error: lack of export 'DecodePointer' of ' Kernel32.dll'.

    Any ideas on this problem?  It is perhaps as simple as a switch in the compiler?

    Thank you.

    I'm not sure it's a simple switch in the project settings in Visual C. The problem is clearly in the standard C runtime library that gets linked to your DLL and refers to exports of Windows which are not available on the RT system. Don't forget that the RT system is a limited Win32 API emulation.

    I usually avoid these problems using Visual C 6 to create DLLs for LabVIEW projects. The standard library of the C runtimes will not know what Windows API reference more recent exports because they have supported even under Win95. So unless your explicitedly reference code not supported RT APIs you wouldn't have problems. If you do not use the standard C file i/o functions and management of memory in your DLL functions, you can also try to link statically C runtime libraries in your DLL, or vice versa depending on what you have now. It may or may not work. Otherwise there is not much else but by using an earlier version of Visual Studio.

  • Store the Teststand ActiveX reference in the LV shift register

    It is posted here

    I'm trying to store the references TestStand ActiveX in a shift register not initialized a VI.  In my case, the references are passed into the TestStand VI (not created from in VI).  If I call the same VI to the next step (same sequence and execution of the previous step), since the shift register ActiveX references are not valid.

    The VI remains reserved to run during these two stages and is not unloaded from memory, so the shift register data should remain intact (in fact, the numerical values of the references are actually kept).  LabVIEW is still trying to close any ActiveX reference, even if they were not created from the VI?  Is there a way around this problem?  Or I'm just something wrong?

    jsiegel-

    In general, when the code is passed a COM reference and code is to keep the reference to a global or shift register, even after his return from the call, the code must add a reference to the object so that the object server knows that the object must be destroyed not. It is also the responsibility of the code that fits on the reference in the world or a register shift to release the reference to the object when it is no longer necessary.  LabVIEW is not different from any other language.

    So, here are more details. TestStand application LabVIEW for run the VI, TestStand after the reference as a parameter to the method of the server to run the LabVIEW VI. COM creates a proxy for reference and give the reference of proxy for the code module. Your VI then stores the value of the proxy reference in the global or the shift register. When your VI ends and returns to TestStand, COM releases the proxy reference, the value in the global or the shift register is no longer valid.

    Basically, you need to add or duplicate the reference to the object passed in LabVIEW by calling the VariantToData function. Pass the existing reference, set the input type to the same type of the reference, and the result will be the reference in doubles. You can assign the double reference to worldwide or register.

    Normally you must well to release the reference later by reading the value of the global or shift register, explicitly calling the function close reference with which to reference, and then assign A Refnum Constant stepped up to the global level or shift register to nullity. In the case of a module of code, I believe that when TestStand unloads the VI, LabVIEW frees the reference correctly. If this isn't the case, you will get a debug message to unpublished during the TestStand stop object if you have this option enabled.

  • Satellite P100-160: Mono sound when you use MciSendString() calling Winmm.dll

    I have a Satellite P100-160.
    The sound works well for some programs, Windows Media Player, etc. Audigy.

    However when I call for its program using MciSendString() calling Winmm.dll I get only mono sound channel, good times left channel is almost silent. SetAudio volume has no effect.
    I've updated the BIOS and the audio driver for the latest versions available on this site.

    Does anyone have a solution or pointer to a solution.

    Is it really a laptop problem?
    Maybe the multimedia function MciSendString() provides only the mono or your have done something wrong?  :|

    See Microsoft Developer Network:
    http://msdn2.Microsoft.com/en-us/library/ms709492 (vs.85) .aspx

    I don't know what you want to do and why you use the MciSendString() to call Winmm.dll, but if the sound display correctly using current players like Windows Media Player, for example, I really put t see any hardware problem m

    Note it is a Toshiba user forum and here you will encounter common users who share knowledge and solve common issues of interest.
    In your case, I recommend you to visit a few Microsoft developer forums and support sites.

    Best regards and good luck

  • File not found when you try to call a dll on LabVIEW Real Time machine

    I have a dll called "DLLRTTEST" that I wrote, and claim successfully on my host.  Now, I try to call this dll from a vi that is on my computer in real time.  Currently, I get a message 'error 7 occurred at the crux of library DLLRTTEST.vi. call function' when running

    In the attached screenshot, I try to ensure that the vi that I am running is indeed on the system in real time.  I then use a 'check if file or folder Exists.vi' to confirm that the dll that I'm about to call exists on the system in real time as well.  However, I always get an error "error 7 file not found" from the node call library feature.

    Any help is appreciated.

    Thanks again for all the responses.  As I said earlier, I had already met and solved the problem identified in the link provided by Nathand.  I had to go down to Visual Studio 2008 to go beyond this particular error, after which the app of auditor of the dll in real-time reported my dll needs to run successfully.

    I just got the phone with Jack in charge NEITHER well, and it turns out that I simply had to compile my dll in release mode.  Decommissioning of VS 2008 I got the correct version of dll (msvcr90.dll), but since I am compiling in debug mode, I found myself using msvcr90d.dll (d for debug) who doesn't have my computer in real time.

  • repeatedly calling a dll that contains a loop

    I would like to call a dll function that contains a while loop. This copy of the data to a buffer loop a signal command "on" is true:

    void Get (double * x, double * y, double z *, double *, double * P, double * R, int on)
    {
    int index is Index - 1;.

    while(on == 1)
    {
    If (index > = buffersize)
    {
    index = 0;
    }
    * x = buffer [index]. Position [0];
    * y = buffer [index]. Position [1];
    * z = buffer [index]. Position [2];
    * Y = buffer [index]. Angles [0];
    * P = buffer [index]. Angles [1];
    * R = buffer [index]. Angles [2];
    index ++;
    }
    }

    I want to call this function from dll once 'on' is set to true and it ends once it becomes false. I also want to be able to 'on' on and outside, so that it can copy data from the buffer when I want to. I could not find a way to do it, and whenever I walk through the program it does not 'stick' when the Get function is called (i.e. the while loop inside the GET is running), as I would expect.

    Thank you for any assistance.

    I guess 'Index', 'buffersize', etc., is static variables?

    In any case, once you called the function expected of LabVIEW for the function to fill. You can not dynamically pass a new value for "on" during the execution of the function. Note that this is not a question of LabVIEW. The same would be true when using this DLL from any other programming language. What you need to do is to have the function use static 'on' and then provide a separate function to set this value. Note that you must also configure the COLD LAKE to be "incoming".

  • Problem calling LabVIEW DLL with c#

    Dear all,

    I compiled a few DLLs in LabVIEW and called these DLLs using c#.
    I'm having trouble passing in strings and arrays as input and output of the DLL.

    Whenever I try to view the string I have entered in a dialog box (this part is written in LabVIEW DLL), a LabVIEW message dialog box appears and the program just stuck there.

    Whenever I try to enter a string or an array to the dll, Microsoft Visual Studio would display "attempt read or write protected memory. It is often an indication that other memory has been corrupted. »

    I attached the vi and also the c# .sln file.

    Can you guys please advise where am I wrong?

    Thank you very much.

    You must allocate strings and arrays of output!

    private void button1_Click (object sender, EventArgs e)
    {
    output string;
    int [] value;
    StringOutput ("A", "B", exit, 3, value, 4);
    }
    }

    Your variable output and value must be preallocated to ensure storage of 3 items respectively. 4. and since you want to receive the C string that you need to increase this to 4 characters terminated by a NULL value.

    String in c# is also a not a C string of object pointer. You must declare the StringOutput() function as follows:

    [DllImport("SharedLib.dll",CallingConvention=CallingConvention.StdCall, Charset=CharSet.Ansi]internal static extern int StringOutput(StringBuilder A, StringBuilder B, out StringBuilder StringOutput, int sizeString, out int[] output, int sizeArray);
    

    Then call like this:

    StringBuilder output = new StringBuilder(4);int[4] array = new int[4];
    
    StringOutput("A", "B", output, output.Capacity, value, value.Length);
    

    Please note that I'm not a pro in c# and usually do not do much in it. Also that this code has not been tested or updated at all, so probably contains some errors. He however point you in the direction of where to look further.

    What you need to understand, is that the C DLL that you created in LabVIEW has a so-called unmanaged interface. This means c# is not able to know how to manage the memory for the parameters at all and you have to do everything yourself, where the obligation to explicitedly initialize variables output and table with a block of memory préallouée.

  • Call a DLL in an integrated project

    Hello world

    I created a Subvi, which returns the recognized audio devices and readers who are searched in a specific way. For audio devices I use lvsound2.llb functions. When I call these functions as soon as it works fine, but when I change the configuration during execution (it's inevitable), it is not up-to-date values.

    Say he finds 4 audio devices and when I disconnect them and rerun the VI it still says 4. To work around this problem, I created a DLL to from this Subvi and call the DLL from my hand. This works very well every time in the Project Explorer, given that the DLL is recalled every time and does not stay in memory in the same way the Subvi front. However, once I build my project into an executable file, it stops working. He always tells me, there is no audio device recognized.

    Project Explorer: Hey 4 devices audio, excellent!

    Casting of Exe: Nope, nothing here.

    Any ideas, where would be the problem? I will attach the VI I used to create a DLL from.

    Kind regards

    Pedro

    Too bad, I had to manually include the "data" of the created DLL file. LabView has failed to do himself.

    Kind regards

    Pedro

  • Sims House Party, the installation program starts, then immediately closes, gives me the error "0 x 80040707 - call function DLL crashed: SORTS." PathGetSpecialFolder.

    original title: error number: 0 x 80040707
    When I try to install the Sims House Party, the installer launches and then immediately closes, gives me the error "0 x 80040707 - call function DLL crashed: SORTS." PathGetSpecialFolder.

    According to the compatility of Windows 7, the House Party is compatible under 64-bit and 32-bit Windows 7. I tried to install it on another computer running Windows 7 32 bit and the error does not occur.

    I am running Windows 7 Professional 64 bit.

    Looks like that method 1 solved my problem.  Normally, I would get this message several times a day.  For more than 3 hours I applied the method 1, and the error has not appeared again.  Thank you very much.

  • Component ActiveX cannot create object wrong when VB script call a dll

    Hello

    I'm new to VB and .NET. We have a SQL job in our application (developed by someone else) hosted on Win Server 2003, who calls the VB script and this script inturns calls a DLL.

    When I run this job, I get the error - component ActiveX cannot create object.

    I tried to print the source of the error (by Err.Source and it gives me 'Microsoft VBScript runtime error').

    Any help would be appreciated. Let me know if I could extract more information.

    Thanks in advance.
    ME

    Hi SenLady,

    The question you have posted here is related to Visual Basic and would be better suited on MSDN forum. I suggest you post your question on the following link.

    http://social.msdn.Microsoft.com/forums/en-us/categories

  • Problem calling seconday DLLs in labview

    Hello

    I'm using Labview 8.6 for my application. The application calls a dll developed in vc ++ (main dll).  During execution of the application, the main dll(vc++) calls another (secondary dll) developed in vb 6.0 dll.

    During the process, the main dll sends data to secondary dll to display data in a pop-up window. After getting the user recognize the display, the vi application stops.

    When the application runs first time (the vi running first time after labview open), the data sent by the main dll are updated in view of the secondary DLLs. But, for the second time from new data of the main dll not are not updated in view of the secondary DLLs.

    Once again, after the closure of the vi and quit labview, if I open and run the vi, then the data of the main dll are updated in dll secodary display. But the maindll data must be updated in the secondary dll without leaving labview.

    I use "Function Call Library" to call the maindll.

    Can someone please give the remody to this problem...

    Thanks in advance.

    Swamy.

    Is - this two dll to reside in the same physical directory as your main vi? They are included in your project?

    -AK2DM

  • Call the dll in BT (usbm.dll)

    Hi all

    I'm having a hard time finding how to call a DLL in Labview. I read a little bit on this subject but am still a beginner. The DLL in question is usbm.dll (http://www.usbmicro.com/, the list of functions & types is documented here). I use the call library node to call the DLL.

    So I call things with no input argument functions work well (for example my first 2 calls check for the presence of the device and the number of devices and work ok returning the correct output)

    Then I try to use functions with arguments (3rd stage of the VI) and Labview does not have them (error 1097). I'll for function "int USBm_DeviceValid (unsigned char device)", in my opinion, that argument must be of type uint8 and output type int8... I tried all numeric types, does not.

    In addition, if I skip the VI 3 and go to step 4 (calling a function that takes 2 parameters and sends a command to my device): the function is executed (for example the unit move), but then Labview block (exits without error message). Is it because of calling the function?

    Any suggestions would be welcome, thanks!

    Hi lvrat, thanks for your suggestions.

    I had the problem. I got an older version of this DLL usbm (as well as some example of LV files) which works very well. Looks like the DLL most recent that I was using has some issue with Labview...

    I enclose these files (they were not easy to find), in case someone else tries to interface to a USBmicro device.

  • SubVIs called screw embedded in a DLL must be located at the opening of a VI that calls the DLL

    I have compiled a DLL that contains two exported screws calling subVIs that calls another DLL that contains hardware dongle functions.  The build DLL works fine and the two screws work fine as source code.  The reason why I want to build a DLL, it is avoid distributing the source dongle screws in order to make the two functions called more sure.  However, when I try to open a VI that makes a call to one of my two functions of the DLL (screws exported), LabVIEW try to find all the subVIs called by VI exported in the DLL.  This suggests that the DLL does not contain the subVIs - probably each VI called by the exported screws must be built in the DLL - or am I completely wrong?  I tried setting all the subVIs and the dongle DLL like 'always understood' and even export all the subVIs too.  The constructor of the DLL is able to include the entire hierarchy of VI in the DLL?  Am I missing a special combination of parameters?

    To summarize my approach:

    A first level VI (to provide an end user with password protected diagram) calls my DLL (two functions are exported screws) that call subVIs that call the DLL dongle.  I want only to provide my DLL and the dongle DLL, NOT all their source code is linked.

    Any help would be greatly appreciated, that this problem has ceased completely in my development.

    Mike

    After traveling through the builder application LAVA forum, I found a post that discusses a problem of construction of the Advanced setting 'Use LabVIEW 8.x file layout'.  This should be checked to make the build work.  Apparently R & D already know the problem (# 158487).  Moreover, previous projects of 8.6 will have this checked by default, which makes them to build properly.

    The new application now works correctly.

    The problem of generation original DLL is also fixed.

Maybe you are looking for

  • Recovery CD does not work

    Hello. I have a laptop of Pavilion dv6700 (service tag dv6838nr). He is running to Win 64-bit Viste. I am prepairing sell ot the computer by "wiping" the hard drive (replace all personal/confidential information on the disk), and by using the recover

  • Key missing back of text message.

    Anyone know what happens to the virtual keyboard to text 'Return KEY'. It shows little send no message of Taxt. I'm talking about the key on the lower right while composing e-mail, but didn't for composing text messages. Anyone know how to go to the

  • How to convert a number in bar code format in oracle ADF?

    HelloIn oracle adf application I want to convert the format of a column in my view object is displayed as a barcode without changing its data type in the database table?Thank you

  • Updated installation before OOBE

    Hello! Long story short, I bought my wife a computer laptop windows 8 as a gift. I would like to upgrade to 8.1 windows and possibly add or remove other software before you give it to her. How can I do this without having to connect and setup a accou

  • Error: Could not load the multiboot modules: already exists

    I tried searching for this error and can find no other instance of this error online.When my computer starts and ESXi startup, I get the pink screen with the message: "don't load the multiboot modules: already exists.It started after installing a har