Ah, I see what you mean :) Still, I think it wouldn't work, because the dynamic linker would not remap the same .text/.data symbols that have already been mapped upon initial loading of the lib (at least not on Linux/Unix — maybe Windows is different in this regard).
(AFAIK, that very property is being used to hijack certain routines (such as in libc) by LD_PRELOADing some other lib that provides the same routines, so that the ones of the same name supplied in a later loaded lib will be ignored.)
To verify, I just played with this a little, and even by manually fixing the bootstrap version issue you mentioned, clearing various DynaLoader arrays before trying to switch libs
undef @DynaLoader::dl_modules;
undef @DynaLoader::dl_shared_objects;
undef @DynaLoader::dl_librefs;
and manually loading the shared object file
DynaLoader::dl_load_file('Devel-Size-0.72/blib/arch/auto/Devel/Size/
+Size.so');
I was not able to get the total_size() XS routine from 0.72 called. Even after having loaded the new (0.72) Size.so (and I did check with strace that it was in fact loaded), it was still the 0.71 version (loaded/mapped first) that was being called... As expected.
Anyhow, even if you could get this to work somehow by further messing around with DynaLoader, it would likely not be easier than just using a different namespace.
|