[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DLL building with Borland 5.0 does not initialize static struct members in the megaco files (version snacc and pactch, 1.7.3 (julio'05) y 1.7.4 (octubre'06).)



Hi:

 

  I am building the generated C++ code by asn1(snacc) compiler with the Borland Enterprise 5.0  environment. But I am having a problem with the some static const struct defined in the megaco.* files. First of all I must mention that i have made up a DLL with Borland with the generated cpp files of snacc(last applied patch 1.7.4 (oct’06).), and i am using this DLL, in my project.  In this situation i can say that all the struct that are initialized in the megaco.cpp with a constructor does not work ( this problem does not happen with a previous release of snacc). I mean, these statict struct´s  are not initialized when they are accessed from the other files (inside of DLL).

 

 

 Example:

//megaco.h

  class MegacoMessage

{

 

 

 .....

   static const AsnTypeSequenceDesc  _desc ;

static const AsnSequenceMemberDesc    _mdescs[];

.....

 

 

//megaco.cpp

 .......

  MegacoMessage ::_desc , variable wit the constructor

 

c onst AsnSequenceTypeDesc MegacoMessage::_desc

(

  &MEDIA_GATEWAY_CONTROLModuleDesc,

  "MegacoMessage", // `MegacoMessage'

  false,

  AsnTypeDesc::SEQUENCE,

  createMegacoMessage,

  _mdescs

);

 

static const AsnSequenceMemberDesc    _mdescs[] initialized by:

 

const AsnSequenceMemberDesc MegacoMessage::_mdescs[] =
{
  AsnSequenceMemberDesc ("authHeader", &AuthenticationHeader::_desc, true), // `authHeader'
  AsnSequenceMemberDesc ("mess", &Message::_desc, false), // `mess'
  AsnSequenceMemberDesc()
}; <--- FINE!!!!!

 

it has not those values when you access in the file m3ua :

//m3ua.cpp

......

MegacoMessage:: mdescs <- IT WORKS. IT has the correct initial values.

  Campo* megaco= dame_tipo_asn1(MEGACO::MegacoMessage::_desc.name, <---  ITS NULL!!!

                                &MEGACO::MegacoMessage::_desc);

 

However, another more simple members in the same file (enum types, that they are  instanced directly in the megaco.cpp file, without not called constructor) works fine:

 

I have to comment too, that If I  compiled the generated cpp files by snacc with my project (NOT DLL) and  these structs are initialized correctly . 

So my question is if perhaps the problem is my compilation of DLL with the Borland environment, or have somebody  seen a similiar problem?. If you believe that the problem

is the Borland environment, it is my fault, and i have to fix the problem with the Borland, but if somebody has faced with a similar problem, i will be grateful with any help or suggestion.

thanks ,
Antonio