C调用示例
加载SDK
在程序包名下方引入动态库
#include \"libsdk.h\"
示例中的libsdk.h该程序在同一路径下。可根据情况自行指定。
调用示例
queryIoc.c文件#include <stdio.h>
#include <string.h>
#include "libsdk.h"
int main() {
char * ioc =
"a-gwas-01.dyndns.org,http://198.13.53.5:808/sts.exe,新华网.cn,freescanonline.com,info.flnet.org,baidu.com,yui.90.kl,1---.com";
GoString str;
str.p = ioc;
str.n = strlen(ioc);
char * ss;
ss = QueryIOC(str);
printf("%s", ss);
free(ss); //手动释放内存。否则在一个不间断的服务中调用动态库会内存泄漏
OnLineUpgrade("lid", "sn", "key", "salt", 0);
return 0;
}
编译:
gcc - o sdk_queryIoc queryIoc.c - L. / -lsdk - lpthread执行:
. / sdk_ sdk_queryIoc