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, this is foo");
23
cls_log("indata=%s", indata);
25
*outdata = (char *)malloc(128);
26
for (i=0; i<strlen(indata) + 1; i++) {
27
if (indata[i] == '1') {
30
(*outdata)[i] = indata[i];
33
*outdatalen = strlen(*outdata) + 1;
34
cls_log("outdata=%s", *outdata);
41
cls_log("Loaded foo class!");
43
cls_register("foo", &h_class);
44
cls_register_method(h_class, "foo", foo_method, &h_foo);