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".

Tags: NI Software

Similar Questions

  • call a DLL that has the user-defined types

    I am trying to call a function in a DLL that is

    int32 system_config(&recCfg, &pulseCfg, errMsg)
    

    recCfg is a structure consisting of 3 double rooms and 2 integers

    and pulseCfg is a structure consisting of just Boolean

    I don't know how to set the input parameters for this call the library feature.

    LabVIEW sees as

    void system_config(void)
    

    I see the only choice of Numeric, Array, String, waveform, digital waveforms, digital data, ActiveX, Adapt to Type and pointer to Instance data for arg1.  ActiveX seems to be the only one to use?

    NYC says:

    I am trying to call a function in a DLL that is

    int32 system_config(&recCfg, &pulseCfg, errMsg)
    

    recCfg is a structure consisting of 3 double rooms and 2 integers

    and pulseCfg is a structure consisting of just Boolean

    Actually contrary to what Simon says you can do in this case. But your line you are showing is unfortunately very unclear, because he does not understand the real typedef for your clusters. So I have to go by what you write in prose that is... Well... not very detailed.

    The first is simply a cluster in LabVIEW with 3 floats to double precision, followed of 2 integers. You find yourself what bitsize integer, you need, as you do not show the typedef in the cluster. In order to connect to a cluster in a CLN you must configure this setting as to adapt to the Type. But be careful who does not work for clusters containing strings or arrays at all. Tables and chains of LabVIEW are something completely different than what awaits a C DLL. You can configure the parameters of function to be C compatible pointers to arrays and strings and LabVIEW will make sure to do the conversion on every call, but you cannot configure the CLN to convert strings and tables within a cluster.

    The second group is really equivalent to a simple Boolean value passed by reference. As you do not show the actual type of the Boolean value, it is difficult to recommend this type of data to use in LabVIEW. Windows BOOL is a 32-bit integer and C++ bool is usually a 8-bit value which would coincide with the Boolean LabVIEW 8-bit use. You cannot configure a Boolean setting directly in the NLCS, so you can either use an integer of size accordingly or create this cluster with a single LabVIEW boolean anyway (if your bool is a bool C++ and not something else) and do the same as for the previous cluster/structure parameter.

  • How to fix the error by calling the procedure that contains THE mode variable

    Hello

    I managed to create a procedure.
    create or replace procedure A_three_num2
    (n_1 number,
    N_2 number: = 2.
    n_3 number: = 3)
    as
    Start
    n_1: = n_2 + n_3;
    dbms_output.put_line (n_1);
    end;

    So I called procedure expects number 8 to display.
    Start
    A_three_num2 (n_2 = > 4, n_3 = > 4);
    end;

    But I got an error. Would you please help me understand the problem?
    ORA-06550: line 2, column 1:
    PLS-00306: wrong number or types of arguments in the call to 'A_THREE_NUM2 '.
    ORA-06550: line 2, column 1:
    PL/SQL: Statement ignored
    1. start
    2 A_three_num2(n_2=>4, n_3=>4);
    3. end;

    Thank you
    Guy

    Try this->

    set serveroutput on
    
    declare
      c_out number;
    begin
      A_three_num2(c_out,4,4);
      dbms_output.put_line('result is: '||c_out);
    end;
    

    Kind regards.

    LOULOU.

  • 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.

  • DLL slows parrellel while loop

    Hello

    I am changing a VI I wrote, to work with another piece of equipment. Communication tends to work directly through labVIEW. My new equipment provided with a driver/dll library and now I have many layers before reaching the material (LabVIEW-> driver-> software-> the measuring equipment). I have some time this account down to run alongside my Subvi who manages my method of measurement of the loop. As I put in place the screw that call DLLs that count - while loop slows down in the same frequency, I'm calling the dll. I've changed the "Run in the user interface thread" setting to the "Run in any thread" option in the call library function node. In fact, which got rid of my problem about 90%. But my meter still comes in a few seconds at the end. I wonder in what sense the crux of library function call delayed a seemingly parallel thread?

    Any suggestion on the place where to continue searching for a fix?

    Welcome them

    / Lorenz

    It is hard to tell what might work without knowing your DLL and what he actually did, but I see something in your loop that will force LabVIEW to toggle the user interface thread! The property node to update the text of the start_method th button will ALWAYS force a change of context for the UI thread. If you can avoid this really should not be possible for the DLL block your loop more. At least try to not update this property if it needs to be changed with regard to the previous value and not at each iteration of the loop.

    A guess is that the DLL actually interfaces to ActiveX code somehow. LabVIEW initializes its ActiveX environment to run in the UI thread, because it is the only safe thread system in LabVIEW to perform many threaded ActiveX components or when the data marshaling is involved. If your DLL tries also to connect to an ActiveX interface, it will be forced to go the UI thread that explains how to access the property in your loop can get delayed.

    And another problem you have is the moment of software. count you down the loop increments of 10 ms, but Windows will be hardpressured for hard real-time performance. While you are not using the "wait until the next ms Multiple" to take account of some jitter, if the loop is blocked for more than 10 ms through an external resource, you will actually jump an interval.

    Better would be to calculate the time elapsed directly reading the timer tick before entering the loop, then use the output of graduation of timer her to "wait until the next ms Multiple" to calculate the difference. Dividing this difference by 10, and then adding your counter value initial this result would give you the same value that you feed your VI calculation, but what about the real system clock, not a counter loop running asynchronously with questionable interval.

  • 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.

  • allocate memory and call the dll function that writes to the pointer

    Hello!

    I have a DLL that has a function as in the following example, I need to call from labview. In C, I need to allocate memory for data and of course the struct. I add the pointer and the length of the data to the struct and call the function with the struct. The function itself inserts values of the struct and affected memory. Someone at - it a working solution how this can be done with Labview?

    typedef struct Thestruct
    {
    UINT16 val1;
    UINT8 val2;
    UINT8 val3;
    DataLength UINT16;
    UINT8 * data;
    } T_Thestruct;

    MY_API status MY_API_CALL udaReceive (handle, T_Thestruct * args);

    I tried in labview (see photo), but I only got values inside the structure as well as the 1097 error, reserved memory included values as before.

    OK, I found the soluton to my own problem. Alignment on the struct must be corrected in Labview. There must be a value between dataLength 2Bytes dummy and the pointer.

  • East - viable to preduce a cyapi.lib dll that is cmpiled by c ++ that can called by labview?

    Now I'm tring to make a dll with cyapi.lib, so labview can call the function for conneting usb device (cy68013 produced by Cypress company), but I'm not sure that this way is viable.
    This my simple code to translate cyapi.lib to cyapi.dll:
    #include "typedef.h".
    #include "CyAPI.h".
    #pragma comment(lib,"CyAPI.lib")

    extern bool _declspec (dllexport) Open_0 (void);

    CCyUSBDevice * USBDevice = new CCyUSBDevice();

    bool Open_0()
    {

    return USBDevice-> Open (0);   get a funtion that can open device 0
    }
    the link error is the following:
    The compilation...
    CyAPI.cpp
    Which connects...
    Creating object Debug/MainDLL.exp and library Debug/MainDLL.lib
    CyAPI.lib (CyAPI.obj): error LNK2001: unresolved external symbol ___security_cookie
    CyAPI.lib (CyAPI.obj): error LNK2001: unresolved external symbol symbol @__security_check_cookie@4
    CyAPI.lib (CyAPI.obj): error LNK2001: symbol ___CxxFrameHandler3 unresolved external
    CyAPI.lib (CyAPI.obj): error LNK2001: symbol __EH_epilog3 unresolved external
    CyAPI.lib (CyAPI.obj): error LNK2001: symbol __EH_prolog3 unresolved external
    CyAPI.lib (CyAPI.obj): error LNK2001: symbol __EH_epilog3_GS unresolved external
    CyAPI.lib (CyAPI.obj): error LNK2001: symbol __EH_prolog3_GS unresolved external

    I think maybe the reason is Ihaven can't initialize all the variable used in the cyapi.lib or there is something wrong in VC development environment.

    Can someone help me?

    If it is compiled with c#, then it is a .NET assembly. To use it, you simply use the .NET features in LabVIEW. You should have received a few examples of programs with it. Essentially, you need to do the same thing that made the example program, but you use LabVIEW .NET to do. There is with LabVIEW provided examples on how to use .NET. In most cases, it is easier to use than to try to call a DLL 'normal '.

  • need names of .dll files that contain icons

    I have win7 Home premium. I'm looking to change an icon for one of my pieces of freeware. Philippe, when I go through the process of 'change icon' I get only one choice, which is the icon even in use. I used to have a couple of files .dll residues many icons, but I lost them. "I used GOOGLE to find something on the files .dll holding icons and encuntered a suggestion that many files in C:\WINDOWS\System32 .dll ' are containers for icons. This turns out be a useless response. When I navigate to a .dll file (there are many of them) with the "change icon" shows, I get a msg of error indicating that the file in question contains no icons. Can someone provide a list of the .dll files that contain icons actually?

    The only other would Netshell.dll

    Not sure if that's what you're looking for.

  • 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.

  • How to call a dll from another dll functions

    Hi, can someone please tell me some examples or instructions on how you go about calling functions from a dll from another dll including the IUR. The two DLLs were created with labwindows cvi.

    Thank you!

    Hi Sinnas,

    You mention that you use a UIR.  A DLL does not have a file UIR as part of it.

    DLL1

    Instead, when you build the DLL first, we'll call it DLL1, you create a header or the files that contain functions that you want to the client code to call.  When you build DLL1, you must export the file DLL1 function for his client to call code header.  Whatever the calling code is (a GUI or another DLL), you must include in the exported DLL1 project headers AND DLL1 .lib file generated when you generate it.

    DLL2

    DLL2 will contain in its project, the header file exported for DLL1, DLL1 .lib file - that gives it the feature in DLL1.  The code can then call any desired DLL1, but as DLL1, you should now have a header file that exports the functions of DLL2 desired HIS client code to call.  When you build DLL2, you create a .lib for THAT DLL file to include in the code of the final customer.

    GUI

    The final customer code will be a few GUI that you create to call DLL2 functions will have the UIR upper layer file.  It will include the exported DLL2 header file and the file .lib DLL2 in his project.  It can then call any function of DLL2.  It is the most clean way to have 2 dll working together.

    NOTE: You can create a GUI to test the lower level DLL1 functions before placing DLL2 in the system.  In fact, it's a good idea to do it - you want to make sure your lower level DLL1 code works properly before construction above it.

    Simple diagram

    Client code (calls to functions of the DLL2 header files) exported

    --------------------------------------------------------------------------

    DLL2 (DLL1 function calls exported in header files)

    --------------------------------------------------------------------------

    DLL1<--------------------  you="" can="" also="" create="" a="" gui="" that="" only="" calls="" dll1="" exported="" header="" files="" to="" test="" out="">

    A suggestion... I create my dll in debug mode and use them to test my code.  But I also build as static libraries.  When I do the final version of the system, I use static libraries.  They are built with the final executable and don't require additional files to install as do the dll.  When you install your system with DLLs, you must include all THE dll and they must be installed in the folder Windows/System32 of the target computer.

    I hope this helps...

    Judy

  • QUESTION about to connect the calling WinsCard.dll drive

    could not get the list of player and connect the player successfully by call winscard.dll under C:\Windows\system32 folder in my local PC, but the other PC could do that.

    My PC environment: 2002 XP, SP3
    the version of winscard.ll is August 4, 2008

    Hi Yang Yu,

    1. Is the issue with the computer recognizes the card reader or the card reader can't read the card?
    2. What is you receive the exact error message?
    3. What is the number and the model of the card reader?

    Refer to the article below and try the steps mentioned, if you use Windows XP Professional x 64 edition.

    A universal serial bus smart card reader that is connected to a Windows Server 2003-based computer may not detect the smart card

    http://support.Microsoft.com/kb/919922

    Your question does contain all the required information necessary for us to help you. Please provide more relevant information to continue troubleshooting as a result.

    How to ask a question

    http://support.Microsoft.com/kb/555375

  • Call a dll via webutil works with Jinitator, but not with the Sun JRE

    Friends,

    I'm trying to call a DLL for Oracle forms using webutil.

    The example I use is from thread WEBUTIL_C_API demo form .

    I followed all the instructions and when I use Jinitiator 1.3.1.28 as the JRE client, then this market. However, when I use Sun JRE 1.5 (1.5.0.19) or Sun 1.6 (1.6.0.14) it does not work and I see the following errors in the java console:
    ERROR>WUL-928 [CApiFunctions.set_invokeoncespec()] Library apiwrap.dll not accessible, or does not contain function eaFindWindow
    ERROR>WUL-910 [CApiFunctions.invokeCApi()] Invoking the function failed: java.lang.NullPointerException
    It appears the problem with the version of Java? Is there something special I need to do to call a dll using the latest versions of the JRE?

    Any help would be appreciated!

    These webutil errors mean that the .dll file is not found in the JRE/bin directory... you have to force webutil to re - load the .dll file into this folder by deleting the webutil.properties file, and then try to run after it again and it should work.

    This properties file are located in either the user/home directory or in the home folder of the JRE.

    i.e.
    C:\Program Files\Java\jre1.5.0_15\webutil.properties

    This file will contain the .dll files that are downloaded to the client... such as configured in the webutil.cfg file.

    Properties of #WebUtil file
    #Mon Aug 10 10:52:10 MDT 2009
    syslib.ffisamp.dll = 1.0
    syslib.d2kwut60.dll = 1.0
    syslib. JNIsharedstubs.dll = 1.0
    syslib. Jacob.dll = 1.0
    syslib.apiwrap.dll = 1.0

  • Cell that contains the formula paste between spreadsheets

    How do I paste the value of a cell that contains the result of a spreadsheet formula has, in a worksheet cell B and still have the operation of the formula? OS 10.11.14, numbers 3.6.1.

    Hi dad,

    It depends on what you mean by "still have the operation of the formula."

    If simply paste you it into a new table in another document, the formula will be stuck more or less intact, but it will not reference all the cells on the original table. If he refers only the cells on the table where he came from, he can refer to these same cells or cells in the same position relative to the new location on the table to which it is glued. You will have probably the best success with her work on the new table, if you copy and then paste the formula itself, rather than the containing cell.

    Repeat what I have not quite clear in the first line: the numbers documents cannot reference cells in other documents of numbers.

    Kind regards

    Barry

  • 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

Maybe you are looking for