dist/include/ contains the MLX and MLX-C headers needed for CGo compilation. Without these, go-mlx cannot be used as a module dependency (headers not found in module cache). Libraries (dylib/metallib) are still gitignored — users build those locally via cmake. Co-Authored-By: Virgil <virgil@lethean.io>
41 lines
693 B
C
41 lines
693 B
C
/* Copyright © 2023-2024 Apple Inc. */
|
|
|
|
#ifndef MLX_ERROR_H
|
|
#define MLX_ERROR_H
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* \defgroup mlx_error Error management
|
|
*/
|
|
/**@{*/
|
|
|
|
typedef void (*mlx_error_handler_func)(const char* msg, void* data);
|
|
|
|
/**
|
|
* Set the error handler.
|
|
*/
|
|
void mlx_set_error_handler(
|
|
mlx_error_handler_func handler,
|
|
void* data,
|
|
void (*dtor)(void*));
|
|
|
|
/**
|
|
* Throw an error.
|
|
*/
|
|
void _mlx_error(const char* file, const int line, const char* fmt, ...);
|
|
|
|
/**
|
|
* Throw an error. Macro which passes file name and line number to _mlx_error().
|
|
*/
|
|
#define mlx_error(...) _mlx_error(__FILE__, __LINE__, __VA_ARGS__)
|
|
|
|
/**@}*/
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|