LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Dereference of object

function that make FatalError is below, error is on *val = atoi(buf), with 32 bits compilation (not able to make 64bit at the moment)

=====

I32 IniGetInteger (
    I8  *ficini,        ///< nom du fichier INI
    I8  *section,       ///< section où lire la valeur
    I8  *cle,           ///< clé dans la section
    I32 *val)           ///< valeur retournée
{
    I8  buf[256];   ///< buffer pour la lecture dans le fichier *.ini
    I32    result;     ///< valeur retournée

    // Lire le nombre entier correspondant à la clé dans la section
    //-------------------------------------------------------------
    if (LitCleIni(ficini, section, cle, buf, sizeof(buf)) < 1)
    {
        LogError("INI : Fic(%s) Sect(%s) Clé(%s)", ficini, section, cle);
        result= ERR_INI;
    }
    else
    {
        *val = atoi(buf);
        LogInfos(GRP_ACCES_FICHIERS, "IniGetInteger : File %s, Section %s, Key %s, Integer => %d", ficini, section, cle, *val);
        result = NOERR;
    }

    // Et retour
    //----------
    return result;
}
=====

 

This afternoon, I'll look to send you project on your FTP location.

0 Kudos
Message 11 of 21
(1,842 Views)

Is there something to do?

I'm still working with CVI 13.0.0 (647) as evaluation mode, till I get an official version from purchasing department, and I CAN'T debug my application (DLL louched from Teststand) as I always have a Fatal Error with this message "dereference of a 4 byte obnject where only 1 bytes exist", preventing reaching the place I've to work on.


Please help me.

0 Kudos
Message 12 of 21
(1,795 Views)

Issue is not always present at each call of function.

It rises up when val=0x30AF4B8 but not at 0x30B0515 nor from 0x30B00BD to 0x30B00111 4 bytes per 4 bytes.

I hope it helps

0 Kudos
Message 13 of 21
(1,788 Views)

CVI 13.0.1 fixed the problem for me.

0 Kudos
Message 14 of 21
(1,776 Views)

OK, I'm in touch with NI France to get the appropriate licence that make me able to apply patches: till now I use an evaluation version and can't. The purchase order in in the circuit but a little bit long to reach NI sales dpt 😞

0 Kudos
Message 15 of 21
(1,773 Views)

I'll get soon the CVI 2013 SP1 and be able to confirm it solves or not this issue.

0 Kudos
Message 16 of 21
(1,752 Views)

It is better with SP1: I can compile both 32- & 64-bits versions without changing selected libs.

BUT the dereference error remains in debug mode (only) that prevents me to work on the project...

 

Note: it seems that more warning are delivered and it is a good thing to make the code safer.

0 Kudos
Message 17 of 21
(1,740 Views)

It's hard to say what the problem might be without knowning how your function is called. Can you post code snippets for the calling function? That is, the function that calls IniGetInteger when you hit the error. Thanks.

 

Have you tried to disable pointer checking for 'val' before performing the assignment? Obviously, you should not have to do that, it's still a bug in CVI somewhere. But does it allow you to continue working until we find and fix the problem?

 

#define DISABLE_RUNTIME_CHECKING(ptr) ((ptr) = (void *) ((uintptr_t)(ptr)))

... DISABLE_RUNTIME_CHECKING(val);
*val = atoi(buf);
...
0 Kudos
Message 18 of 21
(1,732 Views)

See message on 02-07-2014 05:44 AM with code extract.

I'll try your workaround to disable pointer check.

0 Kudos
Message 19 of 21
(1,728 Views)

I saw the message on 02-07-2014. It's the definition of IniGetInteger, which is useful. But I also need to see how IniGetInteger is called. When you run into the error, can you go up one frame on the stack (Run >> Up Call Stack) and show us what that code looks like?

 

The problem appears to be that the pointer information for 'val' is incorrect or getting corrupted. It's hard to find out where that may happen without having full access to your source code. (I realize that you may not be allowed to share your code with NI.)

0 Kudos
Message 20 of 21
(1,725 Views)