CVI 2013 generate invalid code

Hello

CVI 2013 generates an invalid code for the function pointer.

For example, this code works very well in 2012 CVI, but not in CVI 2013. Any idea?

#include 
#include 

struct FunctionType
{
    const char *name;
    void *func;
};

static const struct FunctionType functions[] =
{
    { "func", GetFullPathName },
};

typedef DWORD (WINAPI *GetPathFunc)(LPCSTR, DWORD, LPSTR, LPSTR *);

int main(int argc, char *argv[])
{
    char buf[256];
    GetPathFunc f = (GetPathFunc)functions[0].func;

    if (f != GetFullPathName) {

        puts("Invalid ptr");

    } else {

        if (f(argv[0], sizeof(buf), buf, NULL) > 0) {

            puts(buf);
        }
    }

    return (0);
}

Hello hglee,.

Your code looks fine. I filed the bug report #423480 to follow up the matter.

Our new compiler important GetFullPathName of inconsistently. The main function, it refers directly to the implementation in the kernel32.dll module. In the static variable, it designates the pointer 'import' for the function (a pointer to the implementation). Interestingly, in CVI 2012 refers us to the 'import stub' in both cases (a jump through the pointer to the implementation).

As a temporary workaround, you can manually cancel the extra level of indirection by changing a single line in your code:

   GetPathFunc f = *(GetPathFunc*)functions[0].func;

However, it is DANGEROUS because, depending on how we decide how solve the problem, the workaround solution can become a bug itself in the future, and it may crash your program. So please keep that in mind when you change your code (for example, add a comment and a link to this post to remind you).

Thank you

Peter

Tags: NI Software

Similar Questions

  • Performance of CVI 2013 SP2 with CVI 2015 - Windows XP problem

    I see that XP isn't an operating system in 2015 of the CVI.

    Most of our PC are Win7 now, but we have some legacy units which require XP due to a limitation of external controller processor.

    Is is possible to generate executables in 2015 CVI which will work correctly with the runtime of 2013?

    Alternatively, CVI SP2 from 2013 and 2015 CVI co-exist on the same PC development?

    I would not get stuck with CVI 2013 SP2 for the future just to maintain a few predictable XP-based PC.

    Hi Shr,

    I recommend reading through this community's message: https://decibel.ni.com/content/docs/DOC-23955

    Essentially, you can develop a code in CVI 2015 but set the executable to run on previous versions of the Run-Time Engine. Note that the older version of the RTE of Side-by-Side CVI is 2012. You can indeed install previous versions of the CVI on the same computer. The shared runtime will be set to the latest version. Other versions will be side-by-side. The code is not guaranteed to work with previous versions of the RTE so be sure to test the code locally before moving on to another computer.

  • CVI-2013 SP1 and FDTI development libraries

    We use a test adapter that uses internally a FDTI converter USB to serial. To control the unit, we generate code using FTDIs ftd2xx.lib. Copy the following code compiles and works very well with CVI-2009. But when trying to build the project with SP1 CVI-2013 the linker complains, that ftd2xx.lib is not an archive valid lib.  Any ideas how to fix this?

    Your problem seems to be a 'problem' and already has a workaround solution.
    See the following forum thread:

    http://forums.NI.com/T5/LabWindows-CVI/CVI2013-quot-not-a-valid-archive-quot/TD-p/2525174

    I hope this helps...

  • CVI 2013 SP1 crashes when opening file

    LabWindows 2013 SP1 has suddenly stopped working on my PC.  Any time I try to open a file, or by clicking Browse on the home page, by clicking the open file icon, or by selecting file - open or file - save as from the main menu, I get the message popup that says ' LabWindows/CVI 2013 has stopped working '.

    By clicking on "display characters invisible problem" shows this:

    Signature of the problem:
    Problem event name: BEX
    Application name: cvi.exe
    Application version: 13.0.1.201
    Application timestamp: 52d6eeab
    Fault Module name: CVI.dll
    Fault Module Version: 13.0.1.201
    Timestamp of Module error: 52d6eea1
    Exception offset: 00a4ecd0
    Exception code: c0000409
    The exception data : 00000000
    OS version: 6.1.7601.2.1.0.256.48
    Locale ID: 1033
    Information has additional 1: 417
    More information 2: 417afcd3ce602885d582521ac0f0405e
    3 more information: 39bb
    Additional information 4: 39bb24ea28d79f3c45538f96792cdc59

    These values are always the same.

    I am running Windows 7 Professional, SP 1.

    If you just did a normal installation of CVI 2015, it might still be interesting to try a force reinstall. It is possible that there is a corrupt file of CVI 2013 somewhere.

    Take the information to the same post here, it seems that this issue might be specific to your Windows configuration.

  • Crash of CVI 2013 with the debug version

    Hello

    I'm trying to migrate a large enough project of CVI 2012SP1-CVI 2013 and feels the clang compiler crash when I try a debug on some files.  Clang will also plant (' Labwindows/CVI the Clang compiler has stopped working... ") so I am just trying to compile the file (ctrl-k) in the editor.  Here's what I found:

    • A release not crushed

    • By turning the C99 power button has no effect

    • Change the warning level has no effect (other than the types of warnings that I get, of course)

    • Change the ' debug ' on 'No run-time check' eliminates the crash.

    • 'Enable. Option of obj"eliminates the crash.

    • By turning precompiled headers power has the effect.

    Here is the long message I get from the compiler when this happens (including all the warnings that are always displayed when the level is set to 'None'):

    Any thoughts?  Unfortunately it's a pretty big project that I can't post and it doesn't seem to be an indication of the or the lines in the file that he has problems with it, so I can't limit, although it seems to hint that he has problems with the structures of some sort.  The PC is running Windows 7 Pro 32 bit if it matters.

    Thank you.

    Hi tstanley,

    We could find the cause of the accident of the compiler from your code. We will settle in the next update and you can follow with bug ID 422577.

    The issue occurs when in a function, you have a call to a function that returns a structure in a global variable and then refer to this world in another function. For example:

    struct Foo foo; global variable foo

    Sub FuncA()
    {
    foo = GetStructFoo();
    }

    Sub FuncB()
    {
    do something with foo / / crash
    }

    In this case is because we are bad associate information of temporary pointer with foo in FuncA. Then in FuncB, clang will crash when it tries to access this pointer information.

    There are two workaround solutions, but both require changes in the code.

    1. modify the function that returns the structure, GetStructFoo in my example, the return via a pointer parameter:

    void GetStructFoo(Foo *foo);

    2 use a temporary local variable to manipulate the structure returned and then assign its value to the overall structure:

    struct Foo tempFoo;

    tempFoo = GetStructFoo();

    foo = tempFoo;

    In our next update, we will include the fix for this bug.

  • CVI 2013 SP1 - function calls repeated with pointer on a variable array parameter causes a shift of the index

    I have some functions will be pointers as parameter and CVI 2012 SP1, they work as before without problems but with CVI 2013 SP1 they are now incorrect.

    Here the description of what is happening - I found a cure, but a duty adopt the old code and I think it's clear that nobody don't "captures" all lines in a 'big old code' which are affected (maybe):

    I have functions

    'function_XYZ(int *p_paraArr) '.

    with 'p_paraArr' as pointers on a table (int).

    Suppose I have another function

    "fct_TOP (void)".

    where is a local array variable which is inizialized by

    "int TheArray [25] = {0};

    and inside of this "TOP"-function-body I call a function ".

    "function_XYZ (TheArray).

    There are no complains of the compiler (CVI 2012 or 2013) and the code works (but the CVI 2013 only once!).

    But if I put 'fct_TOP' loop I have a lag in the "TheArray' -memory.  (The loop surrounds the function "TOP"! "")

    This means that the result "TheArray" obtained from "function_XYZ (TheArray)" starts at index '1' not on the index '0' - as the first time that the function "function_XYZ (TheArray)" was performed. ".

    The solution is:

    I only replaced

    "function_XYZ (TheArray)" (<1>)

    by

    "function_XYZ (&(TheArray[0]))" (<2>)

    overall the program now works every time (in the whole loop)-the first time (in the loop).

    In the second version (<2>) everything is necessary to "work well":

    The '&' and parentheses "(...)", which contains the element that may be designated by the '& '.

    And I hope that you believe me: I've tested several times, it was only "little" change that solved the problem.

    So it seems that the ICB 2013 (SP1) is a kind of internal offset index by a repeated execution of the

    "function_XYZ (TheArray).

    but I don't know how or why but I see in debug mode by observing the expected against the values in the table received!

    At the first time the (implicit) internal index of 'TheArray' is '0', but the following times (during the execution of the loop) the internal index passes to '1' (seen in the debugger because that all the expected values were shiftet like that!).

    So there's an explicit index in the table ("function_XYZ (&(TheArray[0]))") necessary to make the first time of this clear code execution.

    There are some good improvements in 2013 CVI (SP1) and I like this environment more than the 2012 version - but:

    There are other "changes" also, in the compiler (or linker...?) that are more rigid than "in ancient times.

    The problem of this kind of error is always the 'old code '!

    It is expected of such behavior.

    The compiler/linker do not complain (a complaint would be good!) writing but he made this mistake (in a loop).

    By the way: my 'compilation Options' are set to 'Extended' (without change in the "..." ("- button - Options) and that all of the boxes, except the" OpenMP_support "-box are checked!"» So I think that I put the very rigid compiler - maybe there are some «...» ' - button - settings to get rid of this problem, but I have not found them/it.

    My request:

    -Check the stiffer compiler by the need of an explicit index

    - or switch to the 'old' behavior with "function_XYZ (TheArray)" always refers to implicit index '0' of the element "TheArray". "."

    Thank you for your messages, comments and suggestions.

    -As I wrote before - maybe it's the style of programming or error"self made"... maybe...
    .. But if I replace 'function_XYZ (TheArray)' by "function_XYZ (&(TheArray[0]))" and
    then it works... Why so and not, if bothe the same? ...

    But as long as I do not post sample code, nobody is going to accept - I accept it. So consider this post more as an allusion to the fact that of the LW/CVI 2012-2013 LW/CVI more changed than just the LW - GUI or certain features: the compiler changed its 'way to'... or almost.

    For this problem, I think that I will use the solution 'use no implicit and explicit pointers'.
    Who should be a good idea taking into account
        http://forums.NI.com/T5/LabWindows-CVI/fatal-run-time-error-dereference-of-out-of-bounds-pointer/TD-...

    mybe also only caused by wrong code... who knows... but for me it is a sufficient reason to act as I suggest above.

    Best regards,
    F.

  • LABWINDOWS CVI 2013 error: bad image in IValidateImage

    Hello

    travel form CVI 2012 to CVI 2013 I Get a sequence of the below errors in the application log.

    The errors seems to be generated whenever I have fly over the screen of the GUI of my application. After a sequence of these errors the application hang.

    Note that:

    -J' already installed the latest patch available for 2013 CVI

    -l' error was not present when compiling with CVI 2012

    -l' error is present also, when you distribute the application o windows XP

    Thank you

    Ezio Riva

    ERROR in widows application log

    The description for event ID 0 in source CVI could not be found. Either the component that triggers this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

    If the event is on another computer, the display information had to be saved with the event.

    The following information has been included in the event:

    [15:24:52.119] [IValidateImage] [FATAL] [.. \mgsource\image.c:9085 assertion failure]: FALSE (bad image in IValidateImage)

    Hi calou,.

    Do you agree with the workaround solutions provided by Daniel?

  • Compiler of CVI 2013: increment / decrement operator assessment

    Trying to pull an old project forward to 2013 CVI, I met a challenge, which is documented as follows:

    «In the summons, the value of the right operand is evaluated before indexing table is made in the left operand.» Expressions, such as a[i] = i++; will assess differently in LabWindows/CVI 2013 compared to previous versions. »

    (There is a somewhat related thread here to do with the order of function arguments are evaluated).

    This change in the order of evaluation is shocking to me. I guess there is some C history behind it, and I won't be able to change that.

    So my question is: what is the way easiest to identify all sites in my code where this could concern me? I ~ 75 000 lines of legacy code. Maybe some regex magic?

    Thank you

    Ian

    Hello

    I'm happy to help you.

    I have test the latest version of clang (3.7 builded SVN), and I can confirm that it detects this 'problem' as a warning (and many other warnings too).

    Also it can integrate with the IDE CVI as external compiler, so it is easy to switch from a regular compiler CVI and this one. I can write a few small "guide" later, if you are interested.

  • Entity Framework generates invalid oracle sql.

    I have similar tables:
    create the table ParameterSets
    (
    Identification number (10, 0) not null,
    Name nvarchar2 (50) not null,
    primary key constraint ParameterSet_PK (Id)
    );

    Create the table settings
    (
    Identification number (10, 0),
    Name nvarchar2 (50).
    Number of ParameterSetId (10, 0) not null,
    primary key constraint Parameters_PK (Id),
    Constraint Parameters_ParamSet_FK foreign key (ParameterSetId) makes reference to ParameterSets (Id)
    );

    create table user groups
    (
    Identification number (10, 0) not null,
    Name nvarchar2 (50) not null,
    Number of ParameterSetId (10, 0) not null,
    primary key constraint UserGroups_PK (Id),
    Constraint UserGroups_ParamSet_FK foreign key (ParameterSetId) makes reference to ParameterSets (Id)
    );

    create table users
    (
    ID number (10,0) not null,
    GroupId number (10,0) not null,
    Name nvarchar2 (50) not null,
    primary key constraint Users_PK (Id),
    Constraint Users_Groups_FK foreign key (GroupId) made reference to UserGroups (Id)
    );

    And I want to do a join between these tables by using this statement:

    application of var = u into entities. Users.Include ("UserGroup.ParameterSet.Parameters")
    where u.Id == 1
    Select u;

    var user = query. SingleOrDefault();

    It's very simple Linq, but it generates invalid SQL Oracle that contains OUTER APPLY.
    I found that there is a bug to Microsoft for this, but can it be fixed by the Oracle provider?
    At the end which layer generates MS SQL final (EF) or ODP (the provider)?
    because "sql query" generates invalid SQL but adds completely SingleOrDefault code Oracle «rownum < 2"»

    The sql is:
    SELECT
    "Project1". "" ID2 "AS"ID. "
    "Project1". ' ' ID ' AS 'ID1 ',.
    "Project1". "' GROUPID ' LIKE 'GROUPID ',.
    "Project1". "" NAME "AS"NAME. "
    "Project1". "" ID1 "LIKE"ID2 ",.
    "Project1". "" NAME1 "AS"NAME1"
    "Project1". "" PARAMETERSETID "AS"PARAMETERSETID. "
    "Project1". "" ID3 "AS"ID3"
    "Project1". "' NAME2 ' AS 'NAME2 ',.
    "Project1". "" C1 "AS"C1"
    "Project1". "" ID4 "AS"ID4,"
    "Project1". "" NAME3 "AS"NAME3"
    "Project1". "' PARAMETERSETID1 ' AS 'PARAMETERSETID1 '.
    (SELECT
    "Filter1". "" ID1 "AS"ID. "
    "Filter1". "' GROUPID ' LIKE 'GROUPID ',.
    "Filter1". "' NAME1 ' AS 'NAME',
    "Filter1". "' ID2 ' AS 'ID1 ',.
    "Filter1". "' NAME2 ' AS"NAME1"
    "Filter1". "" PARAMETERSETID1 "AS"PARAMETERSETID. "
    "Filter1". "" ID3 "LIKE"ID2 ",.
    "Filter1". "" ID4 "AS"ID3"
    "Filter1". "' NAME3 ' AS 'NAME2 ',.
    "Filter2. "" ID5 "AS"ID4,"
    "Filter2. "" NAME4 "AS"NAME3"
    "Filter2. "" PARAMETERSETID2 "AS"PARAMETERSETID1. "
    BOX WHEN ('Filter2". ("" ID5 "IS NULL) NULL THEN 1 OTHER END AS"C1 ".
    FROM (SELECT "Extent1". ' ' ID ' AS 'ID1', "Extent1". "' GROUPID ' LIKE"GROUPID","Extent1 ". "" NAME "AS"Name1","Extent2. ' ' ID ' AS 'ID2', 'Extent2. "' NAME ' AS 'Name2', 'Extent2. "' PARAMETERSETID ' AS 'PARAMETERSETID1', 'Extent3 '. ' ' ID ' AS 'ID3', 'Extent3 '. "" NAME "AS"name5', 'Extent3 '. "' PARAMETERSETID ' AS 'PARAMETERSETID3', 'Extent4 '. ' ' ID ' AS 'ID4', 'Extent4 '. "" NAME "AS"NAME3 ".
    "CLAUDY. "" USERS ""Extent1 ".
    INNER JOIN "CLAUDY. "' USER groups '"Extent2"ON"Extent1 ". "' GROUPID ' = 'Extent2. "" IDENTITY CARD ".
    LEFT OUTER JOIN "CLAUDY. "' USER groups '"Extent3"ON"Extent1 ". ' ' GROUPID ' = 'Extent3. ' "" IDENTITY CARD ".
    LEFT OUTER JOIN "CLAUDY. "" PARAMETERSETS ""Extent4"ON"Extent3 ". "" PARAMETERSETID "="Extent4. " "" IDENTITY CARD ".
    WHERE (1 = "Extent1". ((' ' ID ')) "Filter1".
    OUTSIDE APPLY (SELECT "Extent5". "" ID "AS"ID5","Extent5 ". "" NAME "AS"Conjoint4","Extent5 ". "' PARAMETERSETID ' AS 'PARAMETERSETID2', 'Extent6 '. ' ' ID ' AS 'ID6', 'Extent6 '. "" NAME "AS"NAME6', 'Extent6 '. "' PARAMETERSETID ' AS 'PARAMETERSETID4 '.
    "CLAUDY. "" PARAMETERS ""Extent5. "
    INNER JOIN "CLAUDY. "' USER groups ' 'Extent6' ON 'Extent6 '. "" PARAMETERSETID "="Extent5. " "" PARAMETERSETID ".
    WHERE ("Filter1". ' ' GROUPID ' = 'Extent6. ' ((' ' ID ')) 'Filter2.
    ) "Project1".
    ORDER BY "Project1". "' ID2 ' ASC, 'Project1 '. ' ' ID ' ASC, 'Project1 '. "' ID1 ' ASC, 'Project1 '. "" ID3 "CSA"Project1 ". ' ' C1 ' ASC

    I think shame is for the EF team - this query is simple join between four tables.
    Select * from users u
    UG ug = u.groupid left join user groups. ID
    left join ParameterSets on ug.parametersetid = ps.id ps
    a left join parameters p ps.id = p.parametersetid
    where u.id = 1

    Oracle 12 c and 12 c ODP.NET database are now supported by APPLYING a lateral view. As long as you use these versions or above, you will see is no longer this LINQ error generated in your applications.

    As described above, to support to APPLY necessary to change the Oracle SQL dialect in order to accommodate the LINQ query generation.

  • CVI 2013 and Windows SDK

    Hello

    I just downloaded and installed the complete system of development Labwindows/CVI 2013 on my new computer.

    It's a Win7 64-bit computer.

    What I have to do all the facilities additional to use features of Windows SDK, or is it included in the default installation?

    Thank you

    Kirk

    I'm not one of them, but I'll try ;-)

    You can use the help / find examples and looking for the SDK. This gives 10 examples, including verinfo.cws and winshape.cws...

  • CVI 2013 can be found at #include &lt; rs232.h &gt;

    Hi, I'm a newer version of the CVI.

    my program works well in 2010,

    Initially it alos works well in 2013.but now it has the folloing error.

    the following instructions are needed in 'rs232, c', #include you want to add to the top of the file. (RS232.c) is the name of the c file).

    I click Yes, but it does not work

    the c file was already a "#inclue ".

    is there something important that I get bored?

    TKS

    Build status (rs232.prj - Debug)
    RS232.c - 8 errors
    29, 5 error: implicit declaration of function 'OpenComConfig' is not valid in C99. Make sure that you include the prototype for the function.
    31, 5 error: implicit declaration of function 'SetCTSMode' is not valid in C99. Make sure that you include the prototype for the function.
    31, 18 error: the use of the identifier not declared "LWRS_HWHANDSHAKE_OFF".
    35, 5 error: implicit declaration of function 'FlushInQ' is not valid in C99. Make sure that you include the prototype for the function.
    36, 5 error: implicit declaration of function 'FlushOutQ' is not valid in C99. Make sure that you include the prototype for the function.
    80, 20 error: implicit declaration of function 'GetInQLen' is not valid in C99. Make sure that you include the prototype for the function.
    83, 18 error: implicit declaration of function 'ComRd' is not valid in C99. Make sure that you include the prototype for the function.
    180, 14 error: implicit declaration of function 'ComWrt' is not valid in C99. Make sure that you include the prototype for the function.
    Build failed.

    Hello shayisi,

    CVI displays the error dialog box, because it has detected that some functions declared in rs232.h are used in your source file, so he offers to include the header file.

    I would like to ask you to provide some more details about your configuration, so that we can determine if there is a possible bug with CVI 2013:

    1. You are able to build the projects in the sample from the file \rs232?
    2. You have a rs232.c file that is part of your project?
    3. I understand that your project used to build without errors in CVI 2010. Is this correct?
    4. What options have you selected in the Options of language C, one of the options"Compiler Options?

    Thank you!

  • Where are the models of 'New project' when you use Visual Studio with labwindows/cvi 2013 2012?

    Background:

    Platform: windows 7 X 64

    Visual Studio 2012

    LabWindows/cvi 2013

    First install Visual Studio 2012.  Then follow this installation Labwindows 2013.  In the installation options, I check 'visual studio 2010' (there is no option for VS2012).

    Question: After the installation of Labwindows, I expect to see patterns added to the "New project" dialog box in Visual Studio.   For several years I used labwindows.  Changed the method for using Labwindows with visual studio?

    Thanks in advance for any help.

    Hello jsut64,

    Unfortunately, there is no option to integrate with Visual Studio 2012 yet LabWindows/CVI. We plan to add in a future release.

    Best regards

    = Nelu F. | National Instruments.

  • CVI 2013 S functions in file bug: empty ring

    This seems especially relevant to the service pack 2 of CVI 2013.  I don't see this strong behavior in SP1.

    The issue is the following:

    Sometimes between the realization of my project, some (not all) of the each of the files that are part of my project is not a ring of functions in the file pouplated.  Why?  It makes navigation very difficult file.  The files in question always compile!

    The only solution I can find is CVI to close and reopen.  Then the ring is filled.  Do not simply work the file closing and reopening of the tree of the CVI.

    When you see this behavior could register in the status bar if browse info is beeing gernerated? If so, wait for generation of navigation information and check if the ring is completed.

    Perhaps by changing the file determines the production travel information of this file before other files.

  • I just bought a key code to update from microsoft for windows xp. When I enter the code is says I have an invalid code? can someone help me?

    I JUST BOUGHT a key code to update from microsoft for windows xp. When I enter the code is says I have an invalid code? can someone help me?

    Hello

    1. what exactly are you referring?
    2. Enter the code to upgrade the main code of the Office application or operating system?

    Follow the steps in this article.

    You receive an error message after you enter the product key when you try to install Windows XP
    http://support.Microsoft.com/kb/310637

  • Why the printer email address get "invalid code"?

    I tried 3 times to install my printer Photosmart HP eprint c310. Get "invalid code". What is the problem?

    Hello mateo.

    The code for the printer has a delay of 24 hours, if it has not been put up the time, the code then becomes invalid, as what you see now...

    best solution is to reset Internet services on your printer and then reactivate web services - to the granting of a new code to be printed

    -that should solve the problem you are having

    Although I am an employee of HP, my views and Opinions are mine...

    _ If this Solution helped you please mark as resolved and A Kudos could be Appreciated__

Maybe you are looking for

  • Firefox is able to Cap punctured a page?

    I want to take a cap of screen of a web page and I was wondering if it was possible and how.

  • Portege M400 fan noise

    I have a new Portege M400. The fan runs constantly even when the computer is started cold. The CPU is definitley do not run pretty hot the fan if necessary. None of the settings in the TOSHIBA Power Saver cause the fan turn off, even the setting of l

  • HP pavilion dv6-3259wm

    Need the number of the part for the blu - ray, DVD burner. Also of rather than one for sale if possible. Thank you!

  • No sounds coming... pc notebook Pavilion 15

    theres a problem in the sound system in my laptop... its n of windows 8 a realtek audio high defination...

  • Problems with Windows 10 stuffing to the top of my Windows 7

    So this box is up on my bar telling me to reserve a copy of Windows 10, I so go through the motions of installation and plan an upgrade for a few hours of work further because I have work I need to finish.  Then my browser stop working, if I use IE,