FMI Library: part of JModelica.org
Typedefs | Functions
Handling platform specific defines and functions

Typedefs

typedef void * jm_dll_function_ptr
 A function pointer as returned when DLL symbol is loaded. More...
 

Functions

DLL_HANDLE jm_portability_load_dll_handle (const char *dll_file_path)
 Load a dll/so library into the process and return a handle. More...
 
jm_status_enu_t jm_portability_free_dll_handle (DLL_HANDLE dll_handle)
 Unload a Dll and release the handle. More...
 
jm_status_enu_t jm_portability_load_dll_function (DLL_HANDLE dll_handle, char *dll_function_name, jm_dll_function_ptr *dll_function_ptrptr)
 Find a function in the Dll and return a function pointer. More...
 
charjm_portability_get_last_dll_error (void)
 Return error associated with Dll handling. More...
 
jm_status_enu_t jm_portability_get_current_working_directory (char *buffer, size_t len)
 Get current working directory name. More...
 
jm_status_enu_t jm_portability_set_current_working_directory (const char *cwd)
 Set current working directory. More...
 
const charjm_get_system_temp_dir ()
 Get system-wide temporary directory. More...
 
charjm_mkdtemp (jm_callbacks *cb, char *tmplt)
 Create a uniquely named temporary directory. More...
 
charjm_get_dir_abspath (jm_callbacks *cb, const char *dir, char *outPath, size_t len)
 Get absolute path to an existing directory. More...
 
charjm_mk_temp_dir (jm_callbacks *cb, const char *systemTempDir, const char *tempPrefix)
 Create a unique temporary directory. More...
 
charjm_create_URL_from_abs_path (jm_callbacks *cb, const char *absPath)
 Create a file:// URL from absolute path. More...
 
jm_status_enu_t jm_mkdir (jm_callbacks *cb, const char *dir)
 Make a directory. More...
 
jm_status_enu_t jm_rmdir (jm_callbacks *cb, const char *dir)
 Remove directory and all it contents. More...
 
FMILIB_EXPORT int jm_vsnprintf (char *str, size_t size, const char *fmt, va_list al)
 C89 compatible implementation of C99 vsnprintf. More...
 
FMILIB_EXPORT int jm_snprintf (char *str, size_t size, const char *fmt,...)
 C89 compatible implementation of C99 snprintf. More...
 

Detailed Description

Typedef Documentation

typedef void* jm_dll_function_ptr

A function pointer as returned when DLL symbol is loaded.

Definition at line 52 of file jm_portability.h.

Function Documentation

DLL_HANDLE jm_portability_load_dll_handle ( const char dll_file_path)

Load a dll/so library into the process and return a handle.

jm_status_enu_t jm_portability_free_dll_handle ( DLL_HANDLE  dll_handle)

Unload a Dll and release the handle.

jm_status_enu_t jm_portability_load_dll_function ( DLL_HANDLE  dll_handle,
char dll_function_name,
jm_dll_function_ptr dll_function_ptrptr 
)

Find a function in the Dll and return a function pointer.

char* jm_portability_get_last_dll_error ( void  )

Return error associated with Dll handling.

jm_status_enu_t jm_portability_get_current_working_directory ( char buffer,
size_t  len 
)

Get current working directory name.

jm_status_enu_t jm_portability_set_current_working_directory ( const char cwd)

Set current working directory.

const char* jm_get_system_temp_dir ( )

Get system-wide temporary directory.

char* jm_mkdtemp ( jm_callbacks cb,
char tmplt 
)

Create a uniquely named temporary directory.

Parameters
cb- callbacks for memory allocation and logging. Default callbacks are used if this parameter is NULL.
tmpltDirectory name template ending with XXXXXX. The template is modified by the call.
Returns
A pointer to the modified template. The function returns NULL if the template does not end with XXXXXX, or if the directory could not be created.
char* jm_get_dir_abspath ( jm_callbacks cb,
const char dir,
char outPath,
size_t  len 
)

Get absolute path to an existing directory.

Parameters
cb- callbacks for memory allocation and logging. Default callbacks are used if this parameter is NULL.
dir- path to a directory (relative or absolute).
outPath- buffer for storing the directory
len- of the buffer (if size is larger than FILENAME_MAX + 1 then the path will always fit in)
Returns
Pointer to outPath on success, 0 - on error in which case a message is send to the logger.
char* jm_mk_temp_dir ( jm_callbacks cb,
const char systemTempDir,
const char tempPrefix 
)

Create a unique temporary directory.

Parameters
cb- callbacks for memory allocation and logging. Default callbacks are used if this parameter is NULL.
systemTempDir- directory where the temp dir should be located both absolute and relative path are accepted. System-wide directory is used if this parameter is NULL.
tempPrefix- File name template prefix used when creating temporaty directories. "jm" is used if this is NULL.
Returns
A pointer to the temporary directory name (absolute path, no terminating '/'). Caller is responsible for freeing the memory. The function returns NULL if there were errors in which case a message is send to the logger.
char* jm_create_URL_from_abs_path ( jm_callbacks cb,
const char absPath 
)

Create a file:// URL from absolute path.

Parameters
cb- callbacks for memory allocation and logging. Default callbacks are used if this parameter is NULL.
absPath- absolute path to be converted into the URL
Returns
A pointer to the URL. Caller is responsible for freeing the memory. The function returns NULL if there were errors in which case a message is send to the logger.
jm_status_enu_t jm_mkdir ( jm_callbacks cb,
const char dir 
)

Make a directory.

jm_status_enu_t jm_rmdir ( jm_callbacks cb,
const char dir 
)

Remove directory and all it contents.

FMILIB_EXPORT int jm_vsnprintf ( char str,
size_t  size,
const char fmt,
va_list  al 
)

C89 compatible implementation of C99 vsnprintf.

FMILIB_EXPORT int jm_snprintf ( char str,
size_t  size,
const char fmt,
  ... 
)

C89 compatible implementation of C99 snprintf.