8 #include "objclass/objclass.h"
15 cls_method_handle_t h_foo
;
17 int foo_method(cls_method_context_t ctx
, char *indata
, int datalen
,
18 char **outdata
, int *outdatalen
)
22 cls_log("hello world");
23 cls_log("indata=%s", indata
);
25 *outdata
= (char *)cls_alloc(128);
26 for (i
=0; i
<strlen(indata
) + 1; i
++) {
27 if (indata
[i
] == '0') {
30 (*outdata
)[i
] = indata
[i
];
33 *outdatalen
= strlen(*outdata
) + 1;
34 cls_log("outdata=%s", *outdata
);
36 r
= cls_call(ctx
, "foo", "foo", *outdata
, *outdatalen
, outdata
, outdatalen
);
41 static cls_deps_t depend
[] = {{"foo", "1.0"}, {"bar", "1.0"}, {NULL
, NULL
}};
43 extern "C" cls_deps_t
*class_deps()
50 cls_log("Loaded class test!");
52 cls_register("test", &h_class
);
53 cls_register_method(h_class
, "foo", foo_method
, &h_foo
);