From 0cb29ab388a3080d27e97905ed75c28aefffa770 Mon Sep 17 00:00:00 2001 From: luoliwoshang <2643523683@qq.com> Date: Wed, 11 Jun 2025 19:02:58 +0800 Subject: [PATCH] internal/runtime:runtime.cpp --- .../internal/lib/runtime/_wrap/{runtime.c => runtime.cpp} | 6 ++++-- runtime/internal/lib/runtime/runtime.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) rename runtime/internal/lib/runtime/_wrap/{runtime.c => runtime.cpp} (77%) diff --git a/runtime/internal/lib/runtime/_wrap/runtime.c b/runtime/internal/lib/runtime/_wrap/runtime.cpp similarity index 77% rename from runtime/internal/lib/runtime/_wrap/runtime.c rename to runtime/internal/lib/runtime/_wrap/runtime.cpp index 4dc23cfd..f97d91bd 100644 --- a/runtime/internal/lib/runtime/_wrap/runtime.c +++ b/runtime/internal/lib/runtime/_wrap/runtime.cpp @@ -1,10 +1,12 @@ #include -int llgo_maxprocs() -{ +extern "C" { + +int llgo_maxprocs() { #ifdef _SC_NPROCESSORS_ONLN return (int)sysconf(_SC_NPROCESSORS_ONLN); #else return 1; #endif } +} \ No newline at end of file diff --git a/runtime/internal/lib/runtime/runtime.go b/runtime/internal/lib/runtime/runtime.go index 398d248a..116bcc48 100644 --- a/runtime/internal/lib/runtime/runtime.go +++ b/runtime/internal/lib/runtime/runtime.go @@ -28,7 +28,7 @@ type _runtime struct{} const ( LLGoPackage = "link" - LLGoFiles = "_wrap/runtime.c" + LLGoFiles = "_wrap/runtime.cpp" ) // GOROOT returns the root of the Go tree. It uses the