Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions src/capi/vllm_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,22 @@ void RunRequestDelivery(vllm_request* request) noexcept {

} // namespace

namespace {

// C++ LINKAGE, deliberately hoisted ABOVE the `extern "C"` block below.
//
// This helper returns std::string. Defined INSIDE `extern "C"` it inherits C
// linkage while returning a C++ type: GCC only warns, but Apple Clang's
// -Wreturn-type-c-linkage is an ERROR under the -Werror this project builds
// with, so the whole C ABI failed to compile there. Found downstream by the
// LocalAI vllm-cpp backend, which had to vendor a patch against a pinned SHA to
// build its metal-darwin-arm64 lane; this is that patch, upstream.
//
// Keep helpers that return or take C++ types on THIS side of the boundary.
std::string OrEmpty(const char* s) { return s == nullptr ? std::string() : std::string(s); }

} // namespace

extern "C" {

VLLM_API vllm_model_params vllm_model_params_default(void) {
Expand Down Expand Up @@ -1397,12 +1413,6 @@ VLLM_API vllm_video_params vllm_video_params_default(void) {
return p;
}

namespace {

std::string OrEmpty(const char* s) { return s == nullptr ? std::string() : std::string(s); }

} // namespace

// The opaque video handle: owns the loaded checkpoint set + staged weights.
struct vllm_video_engine {
std::unique_ptr<vllm::multimodal::MiniMaxH3VideoEngine> engine;
Expand Down
Loading