json: link with libm (fix #24272) (#24273)

This commit is contained in:
kbkpbot 2025-04-21 22:51:46 +08:00 committed by GitHub
parent 188d68d32d
commit fd79183122
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 18 additions and 0 deletions

View File

@ -12,6 +12,15 @@ module cjson
#flag @VEXEROOT/thirdparty/cJSON/cJSON.o #flag @VEXEROOT/thirdparty/cJSON/cJSON.o
#include "cJSON.h" #include "cJSON.h"
// As cJSON use `libm`, we need to link it.
$if windows {
$if tinyc {
#flag @VEXEROOT/thirdparty/tcc/lib/openlibm.o
}
} $else {
#flag -lm
}
@[flag] @[flag]
pub enum CJsonType { pub enum CJsonType {
t_false t_false

View File

@ -8,6 +8,15 @@ module json
#include "cJSON.h" #include "cJSON.h"
#define js_get(object, key) cJSON_GetObjectItemCaseSensitive((object), (key)) #define js_get(object, key) cJSON_GetObjectItemCaseSensitive((object), (key))
// As cJSON use `libm`, we need to link it.
$if windows {
$if tinyc {
#flag @VEXEROOT/thirdparty/tcc/lib/openlibm.o
}
} $else {
#flag -lm
}
pub struct C.cJSON { pub struct C.cJSON {
valueint int valueint int
valuedouble f64 valuedouble f64