﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
2678	ExternalObject constructor not called	federico.terraneo@…	Lennart Ochel	"Trying to instantiate an ExternalObject with omc nightly builds results in the constructor not being called, only the destructor.

Please see the attached testcase, to be run with

{{{
omc +s ExtObj.mo
make -f Test.makefile
./Test
}}}


The result I'm seeing is this:

{{{
Dtor called (obj=(nil))
Test: ./ExtObj.h:22: void dtor(void *): Assertion `obj==(void*)0xdeadbeef' failed.
Aborted (core dumped)
}}}


It looks like the constructor is not called. 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"");
  infoStreamPrint(LOG_DEBUG, 0, ""call external Object Constructors finished"");
}

void Test_callExternalObjectDestructors(DATA *data)
{
  if(data->simulationInfo.extObjs)
  {
    omc_NativeInterface_destructor(threadData,$Piface);
    free(data->simulationInfo.extObjs);
    data->simulationInfo.extObjs = 0;
  }
}

}}}

So the destructor is called, the constructor is not."	defect	closed	high	1.9.1	Code Generation	trunk	invalid	ExternalObject constructor	
