Changeset 10513


Ignore:
Timestamp:
Jan 2, 2018 11:58:38 AM (2 years ago)
Author:
vjohnsson
Message:

#5532: Changed the error messages when failing to load or free the FMU binary. 'FMU binary' is used instead of 'DLL'.

Location:
FMILibrary/trunk/src/CAPI/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • FMILibrary/trunk/src/CAPI/src/FMI1/fmi1_capi.c

    r4862 r10513  
    1414*/
    1515
    16 #ifdef __cplusplus 
     16#ifdef __cplusplus
    1717extern "C" {
    1818#endif
     
    3636    char fname[FUNCTION_NAME_LENGTH_MAX];
    3737    int len;
    38    
     38
    3939    if (strlen(fmu->modelIdentifier) + strlen(function_name) + 2 > FUNCTION_NAME_LENGTH_MAX) {
    4040        jm_log_fatal(fmu->callbacks, FMI_CAPI_MODULE_NAME, "DLL function name is too long. Max name length is set to %s.", STRINGIFY(FUNCTION_NAME_LENGTH_MAX));
    4141        return jm_status_error;
    42     }   
     42    }
    4343
    4444    len = jm_snprintf(fname,FUNCTION_NAME_LENGTH_MAX,"%s_%s",fmu->modelIdentifier, function_name);
     
    6060    jm_status_enu_t jm_status = jm_status_success;
    6161
    62     jm_log_verbose(fmu->callbacks, FMI_CAPI_MODULE_NAME, "Loading functions for the co-simulation interface"); 
     62    jm_log_verbose(fmu->callbacks, FMI_CAPI_MODULE_NAME, "Loading functions for the co-simulation interface");
    6363
    6464    /* Workaround for Dymola 2012 and SimulationX 3.x */
     
    9797    LOAD_DLL_FUNCTION(fmiGetBoolean);
    9898    LOAD_DLL_FUNCTION(fmiGetString);
    99     return jm_status; 
     99    return jm_status;
    100100}
    101101
     
    105105    jm_status_enu_t jm_status = jm_status_success;
    106106
    107     jm_log_verbose(fmu->callbacks, FMI_CAPI_MODULE_NAME, "Loading functions for the model exchange interface"); 
     107    jm_log_verbose(fmu->callbacks, FMI_CAPI_MODULE_NAME, "Loading functions for the model exchange interface");
    108108
    109109    LOAD_DLL_FUNCTION(fmiGetModelTypesPlatform);
     
    133133    LOAD_DLL_FUNCTION(fmiGetString);
    134134
    135     return jm_status; 
     135    return jm_status;
    136136}
    137137
     
    223223    fmu->dllHandle = jm_portability_load_dll_handle(fmu->dllPath); /* Load the shared library */
    224224    if (fmu->dllHandle == NULL) {
    225         jm_log_fatal(fmu->callbacks, FMI_CAPI_MODULE_NAME, "Could not load the DLL: %s", jm_portability_get_last_dll_error());
     225        jm_log_fatal(fmu->callbacks, FMI_CAPI_MODULE_NAME, "Could not load the FMU binary: %s", jm_portability_get_last_dll_error());
    226226        return jm_status_error;
    227227    } else {
     
    243243jm_status_enu_t fmi1_capi_free_dll(fmi1_capi_t* fmu)
    244244{
    245     if (fmu == NULL) {     
     245    if (fmu == NULL) {
    246246        return jm_status_error; /* Return without writing any log message */
    247247    }
     
    250250        jm_status_enu_t status =
    251251            (fmu->debugMode != 0) ?
    252                 /* When running valgrind this may be convenient to track mem leaks */ 
     252                /* When running valgrind this may be convenient to track mem leaks */
    253253                jm_status_success:
    254254                jm_portability_free_dll_handle(fmu->dllHandle);
    255255        fmu->dllHandle = 0;
    256256        if (status == jm_status_error) { /* Free the library handle */
    257             jm_log(fmu->callbacks, FMI_CAPI_MODULE_NAME, jm_log_level_error, "Could not free the DLL: %s", jm_portability_get_last_dll_error());
     257            jm_log(fmu->callbacks, FMI_CAPI_MODULE_NAME, jm_log_level_error, "Could not free the FMU binary: %s", jm_portability_get_last_dll_error());
    258258            return jm_status_error;
    259259        } else {
  • FMILibrary/trunk/src/CAPI/src/FMI2/fmi2_capi.c

    r8647 r10513  
    3232        jm_status_enu_t jm_status = jm_portability_load_dll_function(fmu->dllHandle, (char*)function_name, dll_function_ptrptr);
    3333        if (jm_status == jm_status_error) {
    34             jm_log_error(fmu->callbacks, FMI_CAPI_MODULE_NAME, "Could not load the FMI function '%s'. %s", function_name, jm_portability_get_last_dll_error()); 
     34            jm_log_error(fmu->callbacks, FMI_CAPI_MODULE_NAME, "Could not load the FMI function '%s'. %s", function_name, jm_portability_get_last_dll_error());
    3535            *status = jm_status_error;
    3636        }
     
    3838}
    3939
    40 static void fmi2_capi_get_fcn_with_flag(fmi2_capi_t* fmu, const char* function_name, 
    41                                                     jm_dll_function_ptr* dll_function_ptrptr, 
     40static void fmi2_capi_get_fcn_with_flag(fmi2_capi_t* fmu, const char* function_name,
     41                                                    jm_dll_function_ptr* dll_function_ptrptr,
    4242                                                    unsigned int capabilities[],
    4343                                                    fmi2_capabilities_enu_t flag) {
     
    4646        fmi2_capi_get_fcn(fmu, function_name, dll_function_ptrptr, &status);
    4747        if(status != jm_status_success) {
    48             jm_log_warning(fmu->callbacks, FMI_CAPI_MODULE_NAME, "Resetting flag '%s'", fmi2_capability_to_string(flag)); 
     48            jm_log_warning(fmu->callbacks, FMI_CAPI_MODULE_NAME, "Resetting flag '%s'", fmi2_capability_to_string(flag));
    4949            capabilities[flag] = 0;
    5050        }
     
    123123    jm_status_enu_t jm_status = jm_status_success;
    124124
    125     jm_log_verbose(fmu->callbacks, FMI_CAPI_MODULE_NAME, "Loading functions for the co-simulation interface"); 
     125    jm_log_verbose(fmu->callbacks, FMI_CAPI_MODULE_NAME, "Loading functions for the co-simulation interface");
    126126
    127127    jm_status = fmi2_capi_load_common_fcn(fmu, capabilities);
     
    145145                                                                   const fmi2ValueReference[], size_t,
    146146                                                                   const fmi2Real[], fmi2Real[]);*/
    147     LOAD_DLL_FUNCTION_WITH_FLAG(fmi2GetDirectionalDerivative,fmi2_cs_providesDirectionalDerivatives); 
     147    LOAD_DLL_FUNCTION_WITH_FLAG(fmi2GetDirectionalDerivative,fmi2_cs_providesDirectionalDerivatives);
    148148
    149149/* Simulating the slave */
     
    170170    LOAD_DLL_FUNCTION(fmi2GetStringStatus);
    171171
    172     return jm_status; 
     172    return jm_status;
    173173}
    174174
     
    178178    jm_status_enu_t jm_status = jm_status_success;
    179179
    180     jm_log_verbose(fmu->callbacks, FMI_CAPI_MODULE_NAME, "Loading functions for the model exchange interface"); 
     180    jm_log_verbose(fmu->callbacks, FMI_CAPI_MODULE_NAME, "Loading functions for the model exchange interface");
    181181
    182182    jm_status = fmi2_capi_load_common_fcn(fmu, capabilities);
     
    199199                                                                   const fmi2ValueReference[], size_t,
    200200                                                                   const fmi2Real[], fmi2Real[]); */
    201     LOAD_DLL_FUNCTION_WITH_FLAG(fmi2GetDirectionalDerivative,fmi2_me_providesDirectionalDerivatives); 
     201    LOAD_DLL_FUNCTION_WITH_FLAG(fmi2GetDirectionalDerivative,fmi2_me_providesDirectionalDerivatives);
    202202
    203203/* Enter and exit the different modes */
     
    228228    LOAD_DLL_FUNCTION(fmi2GetContinuousStates);
    229229    LOAD_DLL_FUNCTION(fmi2GetNominalsOfContinuousStates);
    230    
    231     return jm_status; 
     230
     231    return jm_status;
    232232}
    233233
     
    321321    fmu->dllHandle = jm_portability_load_dll_handle(fmu->dllPath); /* Load the shared library */
    322322    if (fmu->dllHandle == NULL) {
    323         jm_log_fatal(fmu->callbacks, FMI_CAPI_MODULE_NAME, "Could not load the DLL: %s", jm_portability_get_last_dll_error());
     323        jm_log_fatal(fmu->callbacks, FMI_CAPI_MODULE_NAME, "Could not load the FMU binary: %s", jm_portability_get_last_dll_error());
    324324        return jm_status_error;
    325325    } else {
     
    346346jm_status_enu_t fmi2_capi_free_dll(fmi2_capi_t* fmu)
    347347{
    348     if (fmu == NULL) {     
     348    if (fmu == NULL) {
    349349        return jm_status_error; /* Return without writing any log message */
    350350    }
     
    353353        jm_status_enu_t status =
    354354            (fmu->debugMode != 0) ?
    355                 /* When running valgrind this may be convenient to track mem leaks */ 
     355                /* When running valgrind this may be convenient to track mem leaks */
    356356                jm_status_success:
    357357                jm_portability_free_dll_handle(fmu->dllHandle);
    358358        fmu->dllHandle = 0;
    359359        if (status == jm_status_error) { /* Free the library handle */
    360             jm_log(fmu->callbacks, FMI_CAPI_MODULE_NAME, jm_log_level_error, "Could not free the DLL: %s", jm_portability_get_last_dll_error());
     360            jm_log(fmu->callbacks, FMI_CAPI_MODULE_NAME, jm_log_level_error, "Could not free the FMU binary: %s", jm_portability_get_last_dll_error());
    361361            return jm_status_error;
    362362        } else {
Note: See TracChangeset for help on using the changeset viewer.