MLX Dynamic Library Loading Improved
This release candidate addresses a user-facing issue introduced in a recent optimization that attempts to load libmlxc.dylib via rpath before searching directories. This rpath-first approach benefits Homebrew installations where rpath is correctly configured.
The Problem
When rpath isn't set—the common case for app bundle installations—the dynamic library loading would fail and print a misleading error message to stderr:
ERROR - dynamic.c:21 - CHECK failed: handle->ctx != NULL
Users seeing this error message were confused because the library actually loaded successfully via the fallback path. The error was an expected part of the loading sequence, not an actual failure.
The Solution
The fix replaces the overly aggressive CHECK macro with a simple return code, allowing the C code to fail silently when the rpath-based load attempt doesn't work. The Go code already handles logging appropriately:
- tryLoadByName() now fails silently (intentional fallback behavior)
- tryLoadFromDir() still logs errors via slog.Error() when explicit path loading actually fails
This preserves proper error diagnostics for real failures while eliminating noise from expected fallback scenarios.