﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
2720	Ordering of ExternalObject constructors is reversed	federico.terraneo@…	Per Östlund	"This is a simple example that tries to instantiate two ExternalObject clasees, passing one object as a parameter to the other.

Running this simple example with omc nightly builds results in the following error:

{{{
Bar ctor called (param=(nil))
Test: ./ExtObj.h:28: void *barCtor(void *): Assertion `param==(void*)0x11111111' failed.
Aborted (core dumped)
}}}


It looks like the order in which constructors are called is reversed. A look at the C sources generated by omc resulted in this (Test_01exo.c):

/* Has to be performed after _init.xml file has been read */

{{{
void Test_callExternalObjectConstructors(DATA *data)
{
  /* data->simulationInfo.extObjs = NULL; */
  infoStreamPrint(LOG_DEBUG, 0, ""call external Object Constructors"");
  $Pbar = omc_P_Bar_constructor(threadData, $Pfoo);
  $Pfoo = omc_P_Foo_constructor(threadData);
  infoStreamPrint(LOG_DEBUG, 0, ""call external Object Constructors finished"");
}
}}}


So the constructors are called in reverse order.

Note: the following was built using

{{{
omc +s ExtObj.mo
make -f Test.makefile
./Test
}}}

"	defect	closed	high	1.9.1	Code Generation	trunk	fixed	ExternalObject constructor order	
