Now we have a plug-in update system for the PC client. In the past, the plug-in had the suffix .py. no problem. But recently there is a problem when using cython to compile pyd. When the main program imports the pyd module, it cannot be deleted. Prompt file occupation. It can only be deleted when the main program is closed. But this loses the meaning of hot update. Is there any way to dynamically uninstall pyd or is there a better way?
import xxpyd
import sys
print 'xxpyd' in sys.modules
del sys.modules['xxpyd']
print 'xxpyd' in sys.modules
import time
time.sleep(100)
Even if sys.modules is deleted, pyd cannot be deleted.
There is currently a compromise solution, which is to use a plug-in management class to control the import and acquisition of pyd. The advantage is that it can be hot updated as many times as desired. The disadvantage is that all referenced import syntax must be replaced by the plug-in management class to import
If the imported pyd file cannot be deleted, can it be updated with a new pyd file every time, such as 20170616.pyd (just an example). Other old files will be deleted every time the main program is stopped or at other times.
pyd is essentially dll
There is a saying called dll hell, which describes how difficult it is to do version management of dlls