set_print
This commit is contained in:
parent
2ee9b33e11
commit
43d7d4ebe9
@ -2,12 +2,24 @@ package main
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
typedef void (*CB_S)(char *);
|
||||||
typedef void (*CB_I_S)(int,char *);
|
typedef void (*CB_I_S)(int,char *);
|
||||||
typedef void (*CB_S_I_S_S)(char *,int,char *,char *);
|
typedef void (*CB_S_I_S_S)(char *,int,char *,char *);
|
||||||
typedef void (*CB_S_I_S_S_I)(char *,int,char *,char *,int);
|
typedef void (*CB_S_I_S_S_I)(char *,int,char *,char *,int);
|
||||||
|
extern void Call_CB_S(CB_S func,char* data);
|
||||||
extern void Call_CB_I_S(CB_I_S func,int event,char* data);
|
extern void Call_CB_I_S(CB_I_S func,int event,char* data);
|
||||||
extern void Call_CB_S_I_S_S(CB_S_I_S_S func,char *,int errCode,char* errMsg,char* data);
|
extern void Call_CB_S_I_S_S(CB_S_I_S_S func,char *,int errCode,char* errMsg,char* data);
|
||||||
extern void Call_CB_S_I_S_S_I(CB_S_I_S_S_I func,char *,int errCode,char* errMsg,char* data,int progress);
|
extern void Call_CB_S_I_S_S_I(CB_S_I_S_S_I func,char *,int errCode,char* errMsg,char* data,int progress);
|
||||||
|
extern CB_S DebugPrint;
|
||||||
|
|
||||||
|
int CheckDebugPrint(){
|
||||||
|
if(DebugPrint == NULL){
|
||||||
|
return 0;
|
||||||
|
}else{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
*/
|
*/
|
||||||
import "C"
|
import "C"
|
||||||
|
|
||||||
@ -15,6 +27,17 @@ import (
|
|||||||
"open_im_sdk/open_im_sdk"
|
"open_im_sdk/open_im_sdk"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//export set_print
|
||||||
|
func set_print(print C.CB_S) {
|
||||||
|
C.DebugPrint = print
|
||||||
|
}
|
||||||
|
|
||||||
|
func DebugPrint(info string) {
|
||||||
|
if C.CheckDebugPrint() > 0 {
|
||||||
|
C.Call_CB_S(C.DebugPrint, C.CString(info))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
type Base struct {
|
type Base struct {
|
||||||
ErrCode int32 `json:"errCode"`
|
ErrCode int32 `json:"errCode"`
|
||||||
ErrMsg string `json:"errMsg"`
|
ErrMsg string `json:"errMsg"`
|
||||||
|
@ -3,10 +3,19 @@ package main
|
|||||||
/*
|
/*
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
typedef void (*CB_S)(char *);
|
||||||
typedef void (*CB_I_S)(int,char *);
|
typedef void (*CB_I_S)(int,char *);
|
||||||
typedef void (*CB_S_I_S_S)(char *,int,char *,char *);
|
typedef void (*CB_S_I_S_S)(char *,int,char *,char *);
|
||||||
typedef void (*CB_S_I_S_S_I)(char *,int,char *,char *,int);
|
typedef void (*CB_S_I_S_S_I)(char *,int,char *,char *,int);
|
||||||
|
|
||||||
|
CB_S DebugPrint;
|
||||||
|
|
||||||
|
void Call_CB_S(CB_S func,char* data)
|
||||||
|
{
|
||||||
|
func(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Call_CB_I_S(CB_I_S func,int event,char* data)
|
void Call_CB_I_S(CB_I_S func,int event,char* data)
|
||||||
{
|
{
|
||||||
func(event,data);
|
func(event,data);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user