#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