17 #define LLD_METHODSIZE_MAX (64) 29 void * (*builder_instance_new)(void);
49 void *
handle = dlopen(builder_lib_name, RTLD_NOW);
60 FILE *fp = fopen(conffile,
"r");
69 while(fgets(buffer,
sizeof(buffer), fp) != NULL) {
73 fseek(fp, 0, SEEK_SET);
76 *methodname = (
char **) calloc(line,
sizeof(
char *));
82 while(fgets(buffer,
sizeof(buffer), fp) != NULL) {
91 if(!methodname[ret_num]) {
96 char *after_comment = strstr(buffer,
"/");
117 for(i = 0; i < methodcnt; i ++ ) {
124 this->builder_methods = calloc(methodcnt,
sizeof(
void (*)(
void *)));
125 if(!this->builder_methods) {
130 for( i = 0; i < methodcnt; i ++ ) {
132 this->builder_methods[i] = dlsym(this->dlhandle, methodname[i]);
133 if(!this->builder_methods) {
134 DEBUG_ERRPRINT(
"library API %s is not implement, error detail =%s\n", methodname[i], dlerror());
137 this->builder_method_cnt = methodcnt;
143 if( this->builder_instance_new ) {
155 char **methodnames=NULL;
173 DEBUG_ERRPRINT(
"failed to load methods conf %s\n", builder_interface_conf);
182 DEBUG_ERRPRINT(
"failed to load methods conf %s\n", builder_interface_conf);
212 if(!
this || !this->builder_instance_new) {
217 return this->builder_instance_new();
221 if(!instance || !this->builder_instance_free) {
226 this->builder_instance_free(instance);
235 free(this->builder_methods);
239 if(dlclose(this->dlhandle)) {
#define LL_BUILDER_FAILED
result code : error
This is API definition of builder action API.
int(** builder_methods)(void *initial_parameter)
Director director_new(char *builder_lib_name, char *builder_interface_conf)
director new
static void director_load_interface_method(Director this)
static int director_load_methods(char *conffile, char ***methodname)
void(* initial_result)(int result)
void(* free)(EventInstance this)
#define LL_BUILDER_SUCCESS
result code : success
void director_interface_class_free(Director this, void *instance)
interface class free
This is API definition of Director class.
static int director_open_library(Director this, char *builder_lib_name)
void builder_action_destruct(pthread_t tid)
deconstruct action
#define LLD_METHODSIZE_MAX
static void director_free_methods(int methodcnt, char **methodname)
#define LL_BUILDER_NEWNAME
name definition of plugin interface "new"
#define LL_BUILDER_FREENAME
name definition of plugin interface "free"
pthread_t builder_action_construct(builder_action_parameter_t *parameter)
construct action
void director_construct(Director director, void *initial_parameter, void(*initial_result)(int result))
director construct
static int director_add_methods(Director this, int methodcnt, char **methodname)
director class member definition
void(* builder_instance_free)(void *interface)
void * director_interface_class_new(Director this)
interface class new
#define DEBUG_ERRPRINT(...)
void director_free(Director this)
director free
struct director_t * Director
Typedef class Director, member is defined in struct director_t.
int(** builder_methods)(void *initial_parameter)
void director_destruct(Director director)
director destruct