Skip to main content

Module string_c

Module string_c 

Source
Expand description

C FFI memory management helpers for string and byte buffer allocation.

Provides extern "C" functions for allocating and freeing Rust-owned memory from C code:

  • diffsol_alloc_string / diffsol_free_string — allocate/free Rust-owned C strings.
  • diffsol_alloc / diffsol_free — allocate/free byte buffers.

These are used by the other _c modules when returning dynamically sized data (e.g. serialized equation blobs) to C callers.

Functions§

diffsol_alloc
Allocate aligned memory for arbitrary data
diffsol_alloc_string
Allocate memory for a string of given size (including null terminator) Returns a pointer to writable memory that TypeScript can write to
diffsol_free
Free aligned memory allocated by diffsol_alloc
diffsol_free_string
Free memory allocated by diffsol_alloc_string