From de8f382368213d53f2b8e6c29ed04e81f6e2ac5a Mon Sep 17 00:00:00 2001 From: zongz Date: Wed, 15 May 2024 20:17:24 +0800 Subject: [PATCH] fix: fix protobuf error Signed-off-by: zongz --- src/lib.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index d1e12d1d..f54d9000 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -29,7 +29,7 @@ use std::ffi::{CStr, CString}; pub use kclvm_api::gpyrpc::*; -use kclvm_api::service::capi::{kclvm_service_call, kclvm_service_new}; +use kclvm_api::service::capi::{kclvm_service_call_with_length, kclvm_service_new}; use kclvm_api::service::service_impl::KclvmServiceImpl; use anyhow::Result; @@ -41,7 +41,8 @@ pub fn call<'a>(name: &'a [u8], args: &'a [u8]) -> Result<&'a [u8]> { let args = CString::new(args)?; let call = CString::new(name)?; let serv = kclvm_service_new(0); - kclvm_service_call(serv, call.as_ptr(), args.as_ptr()) + let mut result_len: usize = 0; + kclvm_service_call_with_length(serv, call.as_ptr(), args.as_ptr(), &mut result_len) }; let result = unsafe { CStr::from_ptr(result_ptr) }; Ok(result.to_bytes())