@@ -97,7 +97,7 @@ char* FMIImpl__importFMU(const char* fileName, const char* workingDirectory)
9797 if (!SystemImpl__regularFileExists (fileName )) {
9898 const char * c_tokens [1 ]= {fileName };
9999 c_add_message (-1 , ErrorType_scripting , ErrorLevel_error , gettext ("File not Found: %s." ), c_tokens , 1 );
100- return "" ;
100+ return strdup ( "" ) ;
101101 }
102102 // JM callbacks
103103 jm_callbacks callbacks ;
@@ -115,31 +115,28 @@ char* FMIImpl__importFMU(const char* fileName, const char* workingDirectory)
115115 // FMI context
116116 fmi_import_context_t * context ;
117117 context = fmi_import_allocate_context (& callbacks );
118- fmi_version_enu_t version ;
119118 // extract the fmu file and read the version
119+ fmi_version_enu_t version ;
120120 version = fmi_import_get_fmi_version (context , fileName , workingDirectory );
121121 if (version != fmi_version_1_enu ) {
122- c_add_message (-1 , ErrorType_scripting , ErrorLevel_error , gettext ("Only version 1.0 is supported so far." ), NULL , 1 );
123- return "" ;
122+ c_add_message (-1 , ErrorType_scripting , ErrorLevel_error , gettext ("Only version 1.0 is supported so far." ), NULL , 0 );
123+ return strdup ( "" ) ;
124124 }
125125 // parse the xml file
126126 fmi1_import_t * fmu ;
127127 fmu = fmi1_import_parse_xml (context , workingDirectory );
128128 if (!fmu ) {
129129 const char * c_tokens [1 ]= {fileName };
130130 c_add_message (-1 , ErrorType_scripting , ErrorLevel_error , gettext ("Error parsing the XML file contained in %s." ), c_tokens , 1 );
131- return "" ;
131+ return strdup ( "" ) ;
132132 }
133- // check the platform of FMU.
134- const char * platform = fmi1_import_get_model_types_platform (fmu );
135- fprintf (stderr , "Platform is : %s" , platform );
136133 //fprintf(stderr, "Path is %s\n", fmu->dirPath); fflush(NULL);
137134 // Load the dll
138135 jm_status_enu_t status ;
139136 status = fmi1_import_create_dllfmu (fmu , callBackFunctions , 0 );
140137 if (status == jm_status_error ) {
141- c_add_message (-1 , ErrorType_scripting , ErrorLevel_error , gettext ("Could not create the DLL loading mechanism(C-API)." ), NULL , 1 );
142- return "" ;
138+ c_add_message (-1 , ErrorType_scripting , ErrorLevel_error , gettext ("Could not create the DLL loading mechanism(C-API)." ), NULL , 0 );
139+ return strdup ( "" ) ;
143140 }
144141 // create a file name for generated Modelica code
145142 char * generatedFileName ;
0 commit comments