﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3292	Wrong code for handling string arrays in the external functions	Adrian Pop	Lennart Ochel	"
For string arrays outputs in a function (see also r25730 for an example):
{{{#!mo
    function fmi1GetString
      input FMI1ModelExchange fmi1me;
      input Real stringValuesReferences[:];
      input Real inFlowStatesInput;
      output String stringValues[size(stringValuesReferences, 1)];
      external ""C"" fmi1GetString_OMC(fmi1me, size(stringValuesReferences, 1), stringValuesReferences, inFlowStatesInput, stringValues, 1) annotation(Library = {""OpenModelicaFMIRuntimeC"", ""fmilib""});
    end fmi1GetString;
}}}

we generate code like:

{{{
string_array omc_StringParameters__me__FMU_fmi1Functions_fmi1GetString(threadData_t *threadData, modelica_complex _fmi1me, real_array _stringValuesReferences, modelica_real _inFlowStatesInput)
{
  void * _fmi1me_ext;
  double _inFlowStatesInput_ext;
  string_array _stringValues;
  modelica_integer tmp1;
  tmp1 = size_of_dimension_base_array(_stringValuesReferences, (modelica_integer) 1);
  alloc_string_array(&_stringValues, 1, tmp1);
  _fmi1me_ext = (void *)_fmi1me;
  _inFlowStatesInput_ext = (double)_inFlowStatesInput;
  fmi1GetString_OMC(_fmi1me_ext, size_of_dimension_base_array(_stringValuesReferences, (modelica_integer) 1), (const double*) data_of_real_c89_array(&(_stringValuesReferences)), _inFlowStatesInput_ext, (const char**) data_of_string_c89_array(&(_stringValues)), (modelica_integer) 1);
  unpack_string_array(&_stringValues);
  return _stringValues;
}
}}}

which is wrong as inside the external function call fmi1GetString_OMC we set the strings but when we come back we don't use the value that got changed via: (const char**) data_of_string_c89_array().

We should have something like:
{{{
X = (const char**) data_of_string_c89_array();
fmi1GetString_OMC(..., X, ...)
unpack_string_array(&_stringValues, X);
}}}

Currently, running StringParameters.mos (r25730) leads to a crash in unpack_string_array."	defect	new	high	Future	Code Generation	trunk			
