IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Common

#include "max/c/common.h"

Functions:

M_version()​

const char *M_version()

Gets the MAX Engine version.

  • Returns:

    A string containing the semantic version of the MAX Engine.

M_newStatus()​

M_Status *M_newStatus()

Creates a new status object.

This is required as an argument for several functions, such as M_newRuntimeContext() and M_compileModel(). They will update the status object and you can check for errors with M_isError() and get the status message with M_getError(). For example:

M_Status *status = M_newStatus();
M_RuntimeConfig *runtimeConfig = M_newRuntimeConfig();
M_RuntimeContext *context = M_newRuntimeContext(runtimeConfig, status);
if (M_isError(status)) {
  logError(M_getError(status));
  return EXIT_FAILURE;
}
  • Returns:

    A pointer to the new status object. You are responsible for the memory associated with the pointer returned. You can deallocate the memory by calling M_freeStatus().

M_getError()​

const char *M_getError(const M_Status *status)

Gets an error message from the M_Status parameter.

You should call this only if M_isError() is true.

  • Parameters:

    status – The status object for reporting errors and other messages.

  • Returns:

    A pointer to a null-terminated string containing the error message.

M_isError()​

int M_isError(const M_Status *status)

Checks if status holds an error value.

  • Parameters:

    status – The status object for reporting errors and other messages.

  • Returns:

    0 if there is no error, 1 otherwise.

M_freeStatus()​

void M_freeStatus(M_Status *status)

Deallocates the memory for the status object. No-op if status is NULL.

  • Parameters:

    status – The status object for reporting errors and other messages.