Mach7
Mach7 copied to clipboard
Loading/unloading DLL
Robert suggested a plausible scenario today that might lead to invalid dispatch and should be considered when designing language solution:
- Dll A is loaded
- Classes from Dll A pass through a type switch and get memoized there
- Dll A is unloaded
- Dll B is loaded into the same physical address as Dll A was occupying
- Some of v-tables in Dll B might be in the same spots as others from Dll A
- If any of these vtbl pointers from Dll B now go through the same typeswitch, the typeswitch will incorrectly assume that it has already seen that vtbl-pointer.
To avoid this in language solution, we might need to remove vtbl-pointers from vtbl-map when Dll A is unloaded. Would also be interesting to see how often this may happen in practice with something like COM.