Passing a struct LabWindows/CVI TestStand

I'm passing a struct in a dll written in CVI.

Here's the problem: the code is written in CVI (c code) if I use "struct MyStruct * MyData" as the definition of parameter in the TestStand dll works fine. But if I set my struct using a typedef (i.e. typdef struct MyStruct) then use MyStruct * MyData as TestStand parameter generates a warning.

I have a way to the adapter C\C ++.

It's too late in the programming in order to go back and remove the typedef.

So, how do TestStand accept the typedef?

Thank you

Carmine

In ANSI C, struct names and type names belong to separate namespaces. You can declare the structs several different ways:

(1) struct structName {int x ;};

(2) typedef struct {int x ;} typedefName;}

(3) typedef struct structName {int x ;} typedefName;} Note: structName may be identical to typedefName.

I assume you are using the 2nd example above in which case LabWindows/CVI automatically generates a struct name (something like __unknown_1) which uses Testand.

Even if you said it's too late to remove the typedef, you can add a struct name as in example 3 above? You can use the same name as the typedefName and TestStand will recognize.

Tags: NI Software

Similar Questions

  • passage of data container of teststand labwindows/cvi handle error

    Hello

    I'm moving a container of teststand parameter to labwindows/cvi using this UI API messages following this code created by Peter-r. example:

    https://decibel.NI.com/content/docs/doc-23332

    It is a great example to start with, but as I run using worldwide debbugging lying on the build options, I see that the handle of the containerData object is not released. If I add the CA_DiscardObjHandle (containerData) anywhere in the project, it gives me a FATAL_RUN_TIME_ERROR. This handle must be released? If I call a bunch of these user interface Messages, it will cause memory problems? My code runs right now, great, but I don't want to face a problem of memory later.

    Any help on this will be great!

    Thanks in advance.

    -Luis

    When you add throw it? Maybe you add it to the wrong place. You must add it just after the CA_FreeMemory() called as follows:

    CA_DiscardObjHandle (containerData);

    It should work.

    You can also try the following instead of the functions:

    CA_CreateObjHandleFromInterface (var, & IID_IUnknown, 1, LOCALE_NEUTRAL, 0, 0, & containerData);

    I think that you will still need to get rid of the objhandle when using this API.

    -Doug

  • How to make a manager of UIMessage of PostStep of TestStand in LabWindows/CVI 8.1?

    How to make a manager of UIMessage of PostStep of TestStand in LabWindows/CVI 8.1?

    Hi all

    I have a problem of capture UIMessages motor TestStand for a DLL called from a sequence.
    A search on the forum gave rise to 2 posts on this topic or a similar problem, but with LV and unfortunately, they were not solved.

    TestStand Event 13 - UIMsg_StartInteractiveExecution is not captured by LV operator Interface

    Problems with ActiveX in LabVIEW 7 reminders

    In detail, I want to activate a DLL access the TestStand SequenceContext (variables) in phase of execution of the step.
    A pop-up Panel could then display variables such as the spy does, but more flexible user defined Panel window.

    He is currently working with a periodic timer that causes racing with TestStand conditions while monitoring the variables.
    It works 99%, but I want it to work 100%.

    I found the
     TS_ExecutionAddPostStepCustomUIMessage()
    to indicate to the engine, I want to be informed of one end of the stage with my private UIMessage.
    Next is to implement a callback with
     TS_EngineRegisterUIMessageCallback()
    to retrieve all UIMessages and filter my private.

    Sounds good - works for the capture of events, but TestStand locks and does not continue execution and not to carry out handling
    any operation of the user interface. I have tried 4 solutions (see code), no difference in the result.

    I must kill TestStand to get out of it.

    Attached you will find a stripped down a simple example to reproduce the problem.

    I'd appreciate any help.
    Thanks in advance.

    Kind regards
    Tom

    TestStand 3.5.0
    LabWindows/CVI 8.1.0

    Hello Nick,

    Thank you for your quick response!
    Yes, you are right. That works, I tried today, but...
    isn't this practice as I want it to be. The programmer of a sequence (not me) should take care of the good implementation of a reminder of PostStep to make it work, although he just wants to make a popup. It is not a real problem, but if you use a TestStand MessagePopup command, expected to implement another somewwhere command to make it work. Don't get me wrong, it's just that I don't think that it is a clean solution. And... at least, it is slower.
    I found a tutorial OR a LabView solution for this and two people were asking a LabWindows version. Of course, some are
    interested in this solution. These 2 functions, that I mentioned in my post should work somehow, otherwise they are fools.
    I would really like to know how.

    Thanks again anyway. I'll use your suggestion, if I don't get the problem solved at the root.

    Kind regards
    Tom

  • difference of initial value of string between the steps in the process and an external instance of LabWindows/CVI

    Hello

    I'm curious to know what I see using TestStand, LabWindows/2013 2013 with regard to initial in TestStand string values when you perform the steps in the process or an external instance of LabWindows/CVI.

    I have a step (CVI) string value that is used to check an array of characters stored in an EEPROM to test.  I pass on the Step.Result.String in the CVI by reference.  I then read the table charater of the EEPROM in the chain (Step.Result.String).  The string is then compared against the limit as specified in the test step breast.

    When I run this test step to perform the steps in the process selected in the popup Configuration of the adapter of LabWindows/CVI, it seems that the memory allocated for the string is filled with null characters.  Which is what I expected.

    When I run this test step to execute the steps in an external instance of LabWindows/CVI iselected of the Configuration of the adapter of LabWindows/CVI popup, it seems that the memory allocated for the string is filled with something else.  That is not what I expected.  For example what I see in the memory, it's the first characher is one byte NULL but the remaining bytes are some other values, as shown below:

    F0 00 AD BA 0D F0 AD BA 0D F0 AD BA 0D AD BA 0D AD BA 0D BA 0D AD F0 F0 F0
    F0 AD BA 0D F0 AD BA 0D F0 AD BA 0D F0 AD 0D AD BA 0D AD BA 0D F0 F0 F0 BA...

    In my code I make sure to write a null character in the following location table charater I just write in the chain so I have no problem with the test is working properly.  I have remove the writing from my code null character and was able to verity that the test passes when executing the steps in the process and fails during execution of the steps in an external instance of LabWindows/CVI.

    The returned string contains what I wrote for her, and then the rest of the string is filled with the values that are in the memory allocated for the string.

    Here's my Question: is this the expected behavior for the original string values in TestStand between both types of stage performances?

    Thank you

    Chris Young

    In general teststand not Initializes the unused portion of the string buffer, so it is expected that the values of the memory after character no endpoint will be different, or even to each call. If you happen to be get zeros after the null terminator which was probably due to random character (i.e. the memory allocated just arrived already having zeros in there) or perhaps a debug setting you use perhaps in the Visual C runtime (if you are debugging the process in visual studio or modify visual C runtime heap parameter). TestStand is not initializaing memory after the null terminator character in both cases (I checked the code).

    -Doug

  • cluster complex labwindows cvi

    Hello

    I'm trying to convert a LabVIEW LabWindows/CVI dll code to meet certain requirements of the processor. I'm passing a group of parameters and variables in the DLL, some of the elements which are arrays. My question is twofold:

    1. How to refer to values in the table that is passed as part of my structure?
    2. In what order are multidimensional arrays from LabVIEW to a DLL (column or row-major order)?

    To specify the number 1, if I have a type definition which reads as follows:

    typedef struct {

        int32 dimSizes[2];

        float64 Numeric[1];

     } TD2;

    typedef TD2 **TD2Hdl;

     

    typedef struct {

        int16 index1;

        int16 index2;

        TD2Hdl array;

    } TD1;

    And my function prototype reads:

    int myfcn (*TD1 input);

    How do I référenceriez the (index1, index2) two-dimensional array element array ? None of the following seem to work:

    input->array->Numeric[index1][index2];

    input->array->Numeric[index1 + index2*dim1];

    input->array[1][index1][index2];

    input->array[1][index1 + index2*dim1];

    etc.

    Where dim1 is the length of index1 . To specify the number 2, if I have a two table to a dimension that has two rows and two columns:

    [1, 2]

    [3, 4]

    It happened in the order line field in the list (1, 2, 3, 4), or in the order of the field column in the list (1, 3, 2, 4) to the DLL? This should be of the order of the values stored in input->array->Numeric If I'm not mistaken.

    Thank you very much

    Nathan

    In addition, as mentioned in our correspondence, LabVIEW passes arrays in the order line field and you can dereference the (i, j) element of the array by using the call:

    (*(Input->array))->elt[ j + i*numCols ];

    Where Input is your TD1 object passed as a pointer to your function, so the function prototype might look like:

    int myFcn ( *TD1 Input );

    Thanks for the help Daniel!

  • DirectInput with LabWindows/CVI

    Hello

    I'm trying to use DirectInput to obtain data on the position of a USB joystick in LabWindows/CVI. CVI 2013 comes with headers and libs for direct entry into its subfolder of the sdk and the DirectX SDK comes with a very simple example.

    However, already the first step in opening creating a directinput handle fails to compile - it is essentially copied verbatim from directInput documentation or the joystick sample provided with the DirectX SDK.

    #include
    #define DIRECTINPUT_VERSION 0x0800
    #include 'dinput.h.

    int main (int argc, char * argv [])
    {
    LPDIRECTINPUT8 di;
    HRESULT hr;

    HR = hr = DirectInput8Create (GetModuleHandle (NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID *) & di, NULL);

    return 0;
    }

    60, 42 error: from 'const GUID' (aka "const struct _GUID") to the inconsistent type parameter ' const IID *' (aka ' const struct _GUID *')

    18, 1 in file included from c:\Users\tpaprotta\Documents\National Instruments\CVI\Command-line Application.c:18:

    "dinput.h" (2682,83) c:\program files (x 86) \national instruments\cvi2013\sdk\include\dinput.h:2682:83: Note: passing argument to the parameter "riidltf" here ".

    The same code compiles without problem under Visual Studio 2012.

    Therefore, it is / was a number of questions. Yes, the example in question is C++, so instead of the call

    DirectInput8Create (GetModuleHandle (NULL), DIRECTINPUT_VERSION, IID_IDirectInput8, (VOID *) & di, NULL);

    To call

    DirectInput8Create (GetModuleHandle (NULL), DIRECTINPUT_VERSION, & IID_IDirectInput8, (VOID *) & di, NULL);

    (IID_IDirectInput8 is defined differently depending on if C or C++ calls).

    However, if we make this change, the _IID_IDirectInput8 symbol is not found. The symbol is not in dinput8.lib (which is included with CVI), but rather in the dxguid.lib (which I couldn't find in the records of OR). It is distributed with the DirectX SDK - so I'm now a link against it. I'm curious, however, why NOT distribute dinput8.lib / dll and not other required libraries, which seem to be necessary to use.

  • LabWindows CVI and debugging dll MSVC ++

    We use a written LabWindows/CVI DLLS in the code for Teststand module. This DLL calls a DLL written in MSVC ++.  Is it possible to use the debugger of Labwindows/CVI debug this DLL MSVC ++ (if this DLL MSVC ++ is built with 'good' options)?  Or is possible only using the environment of development MSVC ++?

    Hello mkossmann,

    The CVI compiler generates different types of than MSVC debugging information.

    The debugger CVI doen't understand the debugging information generated by MSVC, so you cannot debug the dll compiled in MSVC.

    Constantin

  • LabWindows/CVI cannot compile a simple code

    Hi all!

    It's looks funny but LabWindows/CVI-9.1.0(427) cannot compile a simple C code

    XML.h

    void f();

    XML.c

    #include 'xml.h.

    typedef struct
    {
    int bar;

    } foo;

    void f()
    {
    int Baz = 0;
    If (!) Baz) baz = 1;
    foop foo;
    return;
    }

    It's not a bug, you make a statement block to a variable foop which is not allowed in the standard ANSI C89.

    You can activate the C99 extensions with a pragma if you want this to work in CVI 9.1

    Menchar

  • LabWindows CVI Full recommended OI does not start

    I made an installer of deployment Teststand-2013. On a target PC (Windows 7 64-bit) it works fine. But on another target PC starting the Labwindows/CVI Full IO recommended (attached screenshot) fails with an error-145 when trying to load testexec.uir. Both targets have Windows7 64-bit and Office 2010 installed. How will I know what ActiveX control is missing or damaged on the second PC?

    I found http://digital.ni.com/public.nsf/allkb/9894BE2B832B7FDE86256ECD00041172. But the Office is installed, and ActiveX Control Pad is obsolete and incompatible for Windows7 64 Bit and is no longer available from Ms.

    mkossmann,

    You can use the option "Hide the license dialog box" on the Installation Options tab. This will not prompt the user to activate TestStand until they try to open the software after installation. What is the desired behavior?

  • Error selection LabWindows CVI Card Configuration

    I am trying to enter the Lab Windows CVI 2012 of TestStand 2012.  When I try to configure LabWindows CVI adapter to

    c:\Users\Public\Public Documents\National Instruments\TestStand 2012\Adapter Support\CVI\tscvirun.prj the window changes the path to

    c:\Users\Public\Documents\National Instruments\TestStand 2012\Adapter Support\CVI\tscvirun.prj and displays the message that it cannot find the file.  I use Windows 7 if that makes a difference.

    Hi herbertwatson,

    I have attached my tscviprj.ini. I have two TestStand 2010 and 2012 TestStand, installed on my machine but the ini is only in the 2010 directory. It is possible, he just needs to be an ini for TestStand work with all facilities CVI. Try to place it in the same directory as your tscvirun.prj for 2012.

    If this does not work, it may be useful CVI, TestStand and then reinstall.

    Kind regards

  • Suddenly have a problem starting LabWindows CVI 7.0 on XP system

    I've been using LabWindows CVI version 7.0 on a Windows XP operating system.  Earlier in the day, I changed my system screen resolution and was working with the applications.

    Everything seemed to work, but at some point, I finished the session, then restarted.   Instead of leaving, I have a Message popup that says "Index passed is out of reach" and the CVI application closes.

    I tried to reinstall CVI original cast CD.  When everything was installed I get the same message when you attempt to start the CVI.

    Anyone have any idea what could be wrong?

    I vaguely remember having a similar problem a few years ago, because I think that something in the windows registry fixed - but I'm not sure.

    Thank you

    Sweeney

    Well, I tried to remove the entries from registry for National Instruments.  After starting and seem to work.

    PROBLEM SOLVED

  • CAObjHandle handle ActiveX object to the NI LabWindows/CVI 2009 Server

    Is there a way to create a CAObjHandle on the ActiveX of LabWindows/CVI server without opening a new application of CVI?

    A bit of history, I am trying to automate the creation of files in HTML help by function panels. Thanks (http://forums.ni.com/t5/LabWindows-CVI/Is-there-a-way-to-automate-generating-the-documentation-from-... I have found that there is a function that exist to achieve this.

    CVI_AppGenHtmlHelpFromFPFile is the function that I need to call, but I got a handle created.

    I can get a handle to it using the CVI_NewApp function, but the problem is that it opens a new application of the CVI (which is certainly not favorable). At a very high level I need this feature to treat more than 100 panels of function in order to see how this can become a bit extensive and involved to open CVI every time. It should be a relatively small appilcation of command line that basically takes the path of the file and go to CVI_AppGenHtmlHelpFromFPFile and it does its magic.

    Any help on this would be greatly appreciated.

    Thank you

    Do you need to treat each Panel function in separate your program calls? If so, is it possible that you could treat several panels by invocation?

    If you're really stuck to running a separate process each time, can you pass some indicator of command line to your program to tell him to close CVI or not? If you don't stop it, then your program can always use CVI_ActiveApp and it would keep reusing the same instance of the CVI over and over again. Then when you call your program for the last Panel of the function in your loop you might pass a command line flag saying it close CVI before leaving.

  • Always get errors trying to control power 7651 YOKOGAWA on Labwindows/CVI

    Hello

    I'm trying to set the voltage on YOKOGAWA 7651 feeding through labwindows/cvi. I've set up a digital slide on my UI with callback function "yoko7651dcvolts" and the name of the constant "YOKO7651DCVOLTS".

    I always get this error when I run my program:

    "FATAL RUN-TIME ERROR: "DcSource.c", line 53, col 65, thread id 0x00001F3C:   Invalid argument type: found 'pointer to double', expected 'pointer to int'."
    

    This error indicates the third argument to the GetCtrlVal function below. The lack of program/compiler pass the variable "yoko1volts" as a whole, but I want to (and should) be able to settle the tensions as floating numbers.

    Of more, even when I said "yoko1volts" as a whole, it stills does not work. All I get is zero, zero and zero... on the power meter whenever I press the digital slide.

    This is the section of the C code which is problemic:

    int CVICALLBACK yoko7651dcvolts (int panel, int control, int event,        void *callbackData, int eventData1, int eventData2){    double yoko1volts;    switch (event)    {        case EVENT_COMMIT:        GetCtrlVal (yoko76511Panel, YOKO7651_1_YOKO7651DCVOLTS, &yoko1volts); // to read the values entered on the numerical meter on the user interface
    
            yk7651_set_volts (yoko76511Panel, yoko1volts); // set the entered values as voltage on the instrument
    
            break;    }    return 0;}
    

    It's the h-file related:

    #define  YOKO7651_1                       4#define  YOKO7651_1_YOKO7651SWITCH        2       /* control type: binary, callback function: yoko7651switch */#define  YOKO7651_1_YOKO7651DCVOLTS       3       /* control type: scale, callback function: yoko7651dcvolts */
    
    
    

    Please help, how can I solve this problem?

    All pilots (including feeding YOKOGAWA 7651) are correctly installed and mounted. In fact, I can successfully turn the power supply on and off with the code below:

    int CVICALLBACK yoko7651switch (int panel, int control, int event,        void *callbackData, int eventData1, int eventData2){    int yoko7651switchstate;    switch (event)    {        case EVENT_COMMIT:        GetCtrlVal (yoko76511Panel, YOKO7651_1_YOKO7651SWITCH, &yoko7651switchstate);        SetCtrlVal (yoko76511Panel, YOKO7651_1_YOKO7651SWITCH, !yoko7651switchstate);        yk7651_output (yoko76511Panel, !yoko7651switchstate);            break;    }    return 0;}
    
    
    

    It is just setting the voltage on the power supply which is very problematic. Any help is appreciated... Thank you.

    I second opinion Al of a disconnection between the UIR and the variable that contains the handle to the Panel.

    As a side note, I noticed that the problematic line reads the value of the controll which callback is executed:

    #define  YOKO7651_1_YOKO7651DCVOLTS       3       /* control type: scale, callback function: yoko7651dcvolts */
    
    int CVICALLBACK yoko7651dcvolts (int panel, int control, int event,        void *callbackData, int eventData1, int eventData2){    double yoko1volts;    switch (event)    {        case EVENT_COMMIT:        GetCtrlVal (yoko76511Panel, YOKO7651_1_YOKO7651DCVOLTS, &yoko1volts); // to read the values entered on the numerical meter on the user interface
    
            yk7651_set_volts (yoko76511Panel, yoko1volts); // set the entered values as voltage on the instrument
    
            break;    }    return 0;}
    
    

    In a situation like this, I will try using GetCtrlVal (Panel, control, & yoko1volts); Instead, which should get rid of all the problems in the control panel manage / control ID.

    Despite this solution works, anyway I'd be deep into the problem like a bad Panel can lead to erratical behaviors in other parts of the program.

  • table dynamic allocation labwindows CVI

    LabWindows CVI there a way to create a dynamic table? A table that contains a variable amount of memory.

    calloc () can be used in CVI to dynamically create a table of desired size, or a standard data type (int, double...) or a data type custom as a struct.

    Dynamically allocated memory must be released with free () when it is no longer used.

    Double * array = NULL;    Set the table pointer

    Array = calloc (numElements, sizeof (double));    Allocate memory and elements of al inizialize 0

    ... to use the elements in the array

    free (matrix);     Allocated dynamically free memory

  • The interface of the AVI with the PC using LabWindows/CVI

    Hi friends,

    I have a vector Network Analyzer Keysight Technologies / Agilent Technologies N5230A. I want to run with the LabWindows/CVI to measure channel 40 GHz. I want to interface the AVI with the PC using LabWindows/CVI. It is really essential for the measures, and I have no experience in doing these things. Would you please direct me to the best, easy as possible of this work? I'm really conscious of the fact that and thank you for your time and concern.

    Mohamed

    I have a vector Network Analyzer Keysight Technologies / Agilent Technologies N5230A. I want to run it with the LabWindows/CVI and measure channel 40 GHz. I want to interface the AVI with the PC using LabWindows/CVI. It is really essential to me, and I have no experience in doing these things. Would you please direct me to the track better, easy and correct these work? I'm really conscious of the fact that and thank you for your time and concern.

    Mohamed

Maybe you are looking for

  • Viewfinder mode 'list' does not

    Hello! I have a weird problem with Finder in my Mac. I have a MacBook Pro (about 3 years) with OSX version installed 10.9.5. Everything worked very well with my Mac, I went on vacation in early August and, when I came back and I turned on my Mac, I f

  • iPad backup restore take more than two days

    WWas of problems with the battery on my iPad Air life. taken at the Genius Bar at Apple Store. they reset and set up to restore a backup, what they did before. After she came back to the top, they said it would take some time to restore because I hav

  • Green lines on screen - Qosmio G15

    Someone has put in place if there is a serious problem with the motherboards in the Qosmios? I have now experienced the second failure of motherboard in my G15. The first was in December 05 which was replaced by Toshiba. Now it happened again 6 month

  • Tecra A3: audible warning at the stop after the installation of the webcam

    Dear ladies and gentlemen, I installed the "Logitech" driver for QuickCam Express camera. Everything works fine. However, when I turned off the computer I get a sound warning just before the melody comes to stop windows.Certainly, it is also somethin

  • AutoUpdates Windows

    Hi all computer Experts, I'm on HP Compaq Presario, MS Windows XP Home Edition SP2 - 32 bit It has the function of automatic updates of Windows in system properties.  I chose this auto-updates feature to update every day.  How can I know that this fu