Files
envi-code/SourceCode/dep_inc/modernGlue/mg_curl_export.h
T
2026-09-28 15:38:57 +08:00

56 lines
1.7 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
#if defined(_WIN32)
#if defined(MODERNGLUE_EXPORTS)
#define GLUE_API __declspec(dllexport)
#else
#define GLUE_API __declspec(dllimport)
#endif
#else
#define GLUE_API
#endif
// 当 DLL 收到网络数据时,通过这个指针回调 ARX
// pData: 接收到的原始字节流(注意:可能不是以 \0 结尾的!)
// length: 字节流的长度
// pUserData: 用户透传指针(ARX 传什么进来,这里就原样送回去)
typedef size_t(*mg_curl_httpWriteCallback)(const char *pData, size_t length, void *pUserData);
#ifdef __cplusplus
extern "C" {
#endif
// 全局初始化(在 ARX 插件加载 acrxEntryPoint 的 Init 阶段调用)
GLUE_API void mg_curl_httpGlobalInit();
// 全局清理(在 ARX 插件卸载阶段调用)
GLUE_API void mg_curl_httpGlobalCleanup();
// 纯粹的 HTTP POST 接口
// url: 请求地址
// headers: 字符串数组,存放请求头 (例如 "Content-Type: application/json")
// headerCount: 请求头的数量
// body: 准备好的 JSON 字符串
// cb: ARX 提供的接收数据的回调函数
// pUserData: ARX 透传的上下文(比如 &response)
// 返回值: CURLcode 对应的整数(0 表示成功)
GLUE_API int mg_curl_httpPost(
const char *url,
const char **headers,
int headerCount,
const char *body,
mg_curl_httpWriteCallback cb,
void *pUserData);
// 纯粹的 HTTP GET 接口 (用于获取模型列表)
GLUE_API int mg_curl_httpGet(
const char *url,
const char **headers,
int headerCount,
mg_curl_httpWriteCallback cb,
void *pUserData);
#ifdef __cplusplus
}
#endif