access violation when reading from a container

I'm trying to test the code from example with a small addition (map.toString()):

try {
FieldList fieldList;
Map map;
fieldList.addUInt( 1, 64 )
.addReal( 6, 11, OmmReal::ExponentNeg2Enum )
.addDate( 16, 1999, 11, 7 )
.addTime( 18, 02, 03, 04, 005 )
.complete();
map.addKeyAscii( "entry_1", MapEntry::AddEnum, fieldList );
map.complete();
const auto& res = map.toString();
} catch ( const OmmException& excp ) {
cout << excp << endl;
}

map.toString() - results in the access violation. What im doing wrong?

Best Answer

  • @dmitry.kozhevnikov

    From my understanding, currently, EMA C++ does not support immediately retrieving data from freshly created OMM containers or messages. It comes from the note in EMA Developer Guide section 3.2.3 Data Class.

    In the old version of EMA, it causes the Access Violation crash when you try to call .toString from the EMA object. But as far as I remember the behavior has been changed to return some message instead of crashing.

    I have tested the codes with ESDK 1.3 and found that it will return the following message instead. "Decoding of just encoded object in the same application is not supported"

    -What version of EMA C++ you currently use? Is this from ESDK 1.3?

Answers

  • It is a known issue fixed in EMA C++ 3.2.1.L1 (ESDK C++/C Release 1.2.1.L1).

    EMA C++ 3.2.1.L1 Issues Resolved
    --------------------------------

    [ESDK-1595] Calling toString on a newly created message throws Access Violation Exception [Case Number: 06484891]

    EMA C++ 3.2.1.L1 or above will return "Decoding of just encoded object in the same application is not supported" instead.