MapLibre Native C API
Public C ABI for the MapLibre Native wrapper.
Loading...
Searching...
No Matches
base.h File Reference

Go to the source code of this file.

Data Structures

struct  mln_buffer_view
 

Macros

#define MLN_HANDLE_NULL   ((uint64_t)0)
 

Typedefs

typedef enum mln_status mln_status
 
typedef enum mln_render_backend_flag mln_render_backend_flag
 
typedef uint64_t mln_runtime
 
typedef struct mln_buffer_view mln_buffer_view
 

Enumerations

enum  mln_status : int32_t {
}
 
enum  mln_render_backend_flag : uint32_t
 

Functions

mln_status mln_buffer_get (mln_buffer buffer, mln_buffer_view *out_view)
 
void mln_buffer_destroy (mln_buffer buffer)
 
uint32_t mln_c_version (void)
 
uint32_t mln_supported_render_backend_mask (void)
 

Detailed Description

Public C API declarations for base ABI types and status values.

Macro Definition Documentation

◆ MLN_HANDLE_NULL

#define MLN_HANDLE_NULL   ((uint64_t)0)

The null handle, for every handle type.

A live handle always carries a nonzero kind tag, so this value names no object of any type. Status-returning functions reject it. Void release functions accept it as a no-op. Output handle parameters that create or acquire ownership require *out_handle to equal it on entry.

Typedef Documentation

◆ mln_buffer_view

typedef struct mln_buffer_view mln_buffer_view

Borrowed data. The data pointer may be null only when size is zero.

Each parameter documents whether its view contains UTF-8 text, serialized data, or arbitrary bytes. The view carries no ownership and requires no trailing null byte.

◆ mln_render_backend_flag

Render backend support flags reported by this native library build.

◆ mln_runtime

typedef uint64_t mln_runtime

Handles are opaque 64-bit generational ids.

Each id packs the handle's type, a slot index, and a reuse generation, so a released handle stays distinguishable from every later handle. Passing a released id, an id of the wrong type, or a value this library never issued reports MLN_STATUS_INVALID_ARGUMENT and leaves the call without effect; mln_thread_last_error_message() distinguishes the cases. Handle values are safe to copy, compare, hash, and move between threads, and carry no ownership on their own.

The bit layout is internal. Hosts pass handles back as issued rather than decoding or synthesizing them.

◆ mln_status

typedef enum mln_status mln_status

Status values returned by status-returning functions.

Enumeration Type Documentation

◆ mln_render_backend_flag

enum mln_render_backend_flag : uint32_t

Render backend support flags reported by this native library build.

◆ mln_status

enum mln_status : int32_t

Status values returned by status-returning functions.

Enumerator
MLN_STATUS_INVALID_ARGUMENT 

A pointer, size field, mask, or handle argument was invalid.

MLN_STATUS_INVALID_STATE 

The object is valid but not currently in a state that permits the call.

MLN_STATUS_WRONG_THREAD 

The handle is thread-affine and the call was made from the wrong thread.

MLN_STATUS_UNSUPPORTED 

The entry point or requested behavior is unavailable in this build.

MLN_STATUS_NATIVE_ERROR 

A native MapLibre error or C++ exception was converted to status.

Function Documentation

◆ mln_buffer_destroy()

void mln_buffer_destroy ( mln_buffer buffer)

Destroys an owned buffer. A null handle is a no-op.

◆ mln_buffer_get()

mln_status mln_buffer_get ( mln_buffer buffer,
mln_buffer_view * out_view )

Borrows the data stored by an owned buffer.

The view remains valid until buffer is destroyed. The caller must not access it concurrently with mln_buffer_destroy().

Returns:

  • MLN_STATUS_OK when out_view receives the borrowed view.
  • MLN_STATUS_INVALID_ARGUMENT when buffer is null or not live, buffer has the wrong handle type, or out_view is null.
  • MLN_STATUS_NATIVE_ERROR when an internal exception is converted to status.

◆ mln_c_version()

uint32_t mln_c_version ( void )

Reports the C ABI contract version. The value is 0 while the ABI is unstable, and will increment on each SemVer major release.

◆ mln_supported_render_backend_mask()

uint32_t mln_supported_render_backend_mask ( void )

Reports the render backends available in this native library build.

The return value is a mask of mln_render_backend_flag values.