Reduce the coupling between main library and ruby bindings
Instead of using a char*xbt_ctx_factory_to_use and then having
SIMIX_context_select_factory() finding the right function from that
name (which induces having SIMIX_context_select_factory hardcoding a
call to the factory initializer), use a direct pointer to that
initializer
From RUBY:
-extern const char *xbt_ctx_factory_to_use;
+typedef void (*SIMIX_ctx_factory_initializer_t)(smx_context_factory_t*);
+extern SIMIX_ctx_factory_initializer_t factory_initializer_to_use;
- xbt_ctx_factory_to_use = "ruby";
+ factory_initializer_to_use = SIMIX_ctx_ruby_factory_init;
From main lib:
- if (xbt_ctx_factory_to_use) {
- SIMIX_context_select_factory(xbt_ctx_factory_to_use);
+ if (factory_initializer_to_use) {
+ (*factory_initializer_to_use)(&(simix_global->context_factory));
(and kill any occurence of SIMIX_ctx_ruby_factory_init() in main lib
Also inlined the SIMIX_context_init_factory_by_name() function which
was called from only one location.
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8688
48e7efb5-ca39-0410-a469-
dd3cf9ba447f