1 #include <ffi_platypus_bundle.h> 2 #include <string.h> 3 4 typedef struct { 5 char *name; 6 int value; 7 } foo_t; 8 9 foo_t* foo__new(const char * class_name,const char * name,int value)10foo__new(const char *class_name, const char *name, int value) 11 { 12 (void)class_name; 13 foo_t *self = malloc( sizeof( foo_t ) ); 14 self->name = strdup(name); 15 self->value = value; 16 return self; 17 } 18 19 const char * foo__name(foo_t * self)20foo__name(foo_t *self) 21 { 22 return self->name; 23 } 24 25 int foo__value(foo_t * self)26foo__value(foo_t *self) 27 { 28 return self->value; 29 } 30 31 void foo__DESTROY(foo_t * self)32foo__DESTROY(foo_t *self) 33 { 34 free(self->name); 35 free(self); 36 } 37