Skip to main content

M_compileModelSync

Function M_compileModelSync 

Source
pub unsafe extern "C" fn M_compileModelSync(
    context: *const M_RuntimeContext,
    compileConfig: *mut *mut M_CompileConfig,
    status: *mut M_Status,
) -> *mut M_AsyncCompiledModel
Expand description

Synchronously compiles a model.

Unlike M_compileModel(), this blocks until model compilation is complete. It returns an M_AsyncCompiledModel without needing to call M_waitForCompilation(). All other setup and usage is identical to M_compileModel().

@param context The runtime context, from M_newRuntimeContext(). @param compileConfig Address of compilation configuration for your model created with M_newCompileConfig(), and with the model set via M_setModelPath(). Ownership of configuration is handed over to API. @param status The status used to report errors in the case of failures during model compilation.

@returns A pointer to an M_AsyncCompiledModel. You are responsible for the memory associated with the pointer returned. You can deallocate the memory by calling M_freeCompiledModel(). If the config is invalid, it returns a NULL pointer. If the model compilation fails, the pointer is NULL and the status parameter contains an error message. compileConfig will be reset to NULL after this call irrespective of status and cannot be reused, and any subsequent calls must take a new M_CompileConfig.