@@ -242,7 +242,7 @@ int FMIImpl__initializeFMIImport(const char* file_name, const char* working_dire
242242 callback_functions .freeMemory = free ;
243243 }
244244 fmi_import_context_t * context = fmi_import_allocate_context (& callbacks );
245- * fmiContext = context ;
245+ * fmiContext = mk_some ( context ) ;
246246 // extract the fmu file and read the version
247247 fmi_version_enu_t version ;
248248 version = fmi_import_get_fmi_version (context , file_name , working_directory );
@@ -260,7 +260,7 @@ int FMIImpl__initializeFMIImport(const char* file_name, const char* working_dire
260260 c_add_message (-1 , ErrorType_scripting , ErrorLevel_error , gettext ("Error parsing the modelDescription.xml file." ), NULL , 0 );
261261 return 0 ;
262262 }
263- * fmiInstance = fmi ;
263+ * fmiInstance = mk_some ( fmi ) ;
264264 // Load the binary (dll/so)
265265 jm_status_enu_t status ;
266266 status = fmi1_import_create_dllfmu (fmi , callback_functions , 0 );
@@ -315,7 +315,7 @@ int FMIImpl__initializeFMIImport(const char* file_name, const char* working_dire
315315 * experimentAnnotation = FMI__EXPERIMENTANNOTATION (mk_rcon (experimentStartTime ), mk_rcon (experimentStopTime ), mk_rcon (experimentTolerance ));
316316 /* Read the model variables from the FMU's modelDescription.xml file and create a list of it. */
317317 fmi1_import_variable_list_t * model_variables_list = fmi1_import_get_variable_list (fmi );
318- * modelVariablesInstance = model_variables_list ;
318+ * modelVariablesInstance = mk_some ( model_variables_list ) ;
319319 size_t model_variables_list_size = fmi1_import_get_variable_list_size (model_variables_list );
320320 /* get model variables value reference list */
321321 const fmi1_value_reference_t * model_variables_value_reference_list = fmi1_import_get_value_referece_list (model_variables_list );
@@ -375,8 +375,11 @@ int FMIImpl__initializeFMIImport(const char* file_name, const char* working_dire
375375 * Releases all the instances of FMI Import.
376376 * From FMIL docs; Free a variable list. Note that variable lists are allocated dynamically and must be freed when not needed any longer.
377377 */
378- void FMIImpl__releaseFMIImport (intptr_t fmiModeVariablesInstance , intptr_t fmiInstance , intptr_t fmiContext )
378+ void FMIImpl__releaseFMIImport (void * ptr1 , void * ptr2 , void * ptr3 )
379379{
380+ intptr_t fmiModeVariablesInstance = RML_FETCH (RML_OFFSET (RML_UNTAGPTR (ptr1 ),1 ));
381+ intptr_t fmiInstance = RML_FETCH (RML_OFFSET (RML_UNTAGPTR (ptr2 ),1 ));
382+ intptr_t fmiContext = RML_FETCH (RML_OFFSET (RML_UNTAGPTR (ptr3 ),1 ));
380383 free ((fmi1_import_variable_list_t * )fmiModeVariablesInstance );
381384 fmi1_import_t * fmi = (fmi1_import_t * )fmiInstance ;
382385 fmi1_import_destroy_dllfmu (fmi );
0 commit comments