There's a problem with plugins: the instance handles are made into roots. The Felix C++ dynlink code in src/rtl/flx_dynlink.cpp says in create:
lib = lib_a; gcp = gcp_a; thread_frame = lib->thread_frame_creator( gcp); ++lib->refcnt; gcp->collector->add_root(thread_frame); start_proc = lib->start_sym(thread_frame, argc, argv, stdin_,stdout_,stderr_); main_proc = main_sym?main_sym(thread_frame):0; usr_create(); That "start_sym" for a program is the procedure that actually runs your program. So it's important the thread frame is a root or the gc might erase the top level object from under your feet. Well, that was true in older Felix where the GC didn't scan the stack for roots which it does now. Note, running the start_sym doesn't run your program .. it just creates the procedure closure! However flx_run does this for the main program: { con_t *top = instance->start_proc; fthread_t *ft = new (*gcp, _fthread_ptr_map, false) fthread_t(top); collector->add_root(ft); active->push_front(ft); } So this is also adding an fthread_t as a root. Now, an fthread_t is actually a GC traceable object, it has its own RTTI. And thread_frames do as well. So actually I the library should make instances a root. Either they're locked into fthreads which are roots, or, they're stored somewhere in another thread_frame (in the case of a plugin). The real problem is that the instance creator is decoupled from the code that uses the created instance. In particular, the library code is fairly generic, it doesn't assume what has to be run to create the start_proc. However the dynlink objects aren't scannable by the GC. -- john skaller skal...@users.sourceforge.net http://felix-lang.org ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk _______________________________________________ Felix-language mailing list Felix-language@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/felix-language