So now I need to clean up the dynamic link stuff. 1. get rid of setup =============
Now, when you initialise a library, first the C++ constructor is called: thread_frame = lib->thread_frame_creator( gcp); and then the "body" of the constructor: start_proc = lib->start_sym(thread_frame, argc, argv, stdin_,stdout_,stderr_); The start_sym function is created by the compiler using a macro: #define FLX_START_WRAPPER(mname,name,x)\ extern "C" FLX_EXPORT ::flx::rtl::con_t *name##_flx_start(\ mname::thread_frame_t *__ptf,\ int argc,\ char **argv,\ FILE *stdin_,\ FILE *stdout_,\ FILE *stderr_\ ) {\ __ptf->argc = argc;\ __ptf->argv = argv;\ __ptf->flx_stdin = stdin_;\ __ptf->flx_stdout = stdout_;\ __ptf->flx_stderr = stderr_;\ return (new(*__ptf->gcp,mname::x##_ptr_map,false) \ mname::x(__ptf)) ->call(0);\ } The definition is generated by: "struct thread_frame_t {"; " int argc;"; " char **argv;"; " FILE *flx_stdin;"; " FILE *flx_stdout;"; " FILE *flx_stderr;"; " ::flx::gc::generic::gc_profile_t *gcp;"; " ::flx::gc::generic::gc_shape_t const * const shape_list_head;"; ... In other words, we pass in the argument array and file channels 0,1,2 to the creator which stores these values in the thread frame before executing the rest of the init routine (which is typically your program). NOW: at the moment, plugins ALSO follow that with a setup function that accepts a string and returns an int. The idea was to parse it, so the string is a "dynamically typed initialisation spec". But why not get rid of setup, and just pass data using the argv/argc mechanism? There's no particular reason a plugin should see the process argv/argc. 2. The naming of stuff is inconsistent. The init routine is called moduename_flx_start but the variable used to store it is called start_sym. But it actually invokes the program _init_() procedure .. -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Own the Future-Intel(R) Level Up Game Demo Contest 2013 Rise to greatness in Intel's independent game demo contest. Compete for recognition, cash, and the chance to get your game on Steam. $5K grand prize plus 10 genre and skill prizes. Submit your demo by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2 _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language