|unloading a package and reloading it [message #1726612]
||Tue, 15 March 2016 05:56
| James Lockwood
Registered: July 2009
I would like to be able to unload a package and reload it during configuration time.|
I am going to skip unimportant steps but here is the jist of why.
My typical scenario for making a legacy library function as if it were an XdcTools configurable module is to define metaonly config parameters which correspond to the #defined parameters in the legacy .h configuration file. I configure the module and call a function which uses a template to create the legacy config.h file, and if it results in a different file being created (different configuration), I then recompile the package so that the package will be up to date before the link process begins. After re-compiling, I create Xdc instances of this module.
This works fine unless the legacy module declares structs which omit/add fields (with #if <some_config_enabled> / #endif pair), and this struct definition needs to be in my Instance_State. To solve this problem, I have created an interface, of which my module inherits. In the interface, I have the structs which contain possible variations in their definitions based on the configuration. The interface .xdc file itself is also generated from a template (which if it changes is part of the condition of triggering an automatic recompile) and now these have the parallel structures the same as the legacy module will.
Unfortunately, since the struct definitions are not known until configuration time, and my module has already been loaded, when it comes to processing my instance$static$init, the previous definitions are already loaded, and I can not find any way to make the xdc environment re-load the new definition.
In poking around, I found that xdc.services.intern.xsr.java has the PkgLoader Class. But I can not use this, as it calls the findPkgClass method which in turn references a HashMap and if the entry for the package exists, it uses the already existing defined class. I would really like the PkLoader Class to be augmented such that the hashmap entry can be deleted, so that the exec function can be called again, and it would then load my newly defined module.
I would like to kindly request this 'feature'. Does this make sense, or would there be side-effects that I am unaware of?
Powered by FUDForum
. Page generated in 0.01700 seconds