Please enable JavaScript to view this site.

ESL Documentation

Navigation: » No topics above this level «

Q19 When are dlls unloaded?

Scroll Prev Top Next More

If an ESL program executes a change to program, then the DLLs are NOT released because the same executable is still running, and we don't unload them ourselves.

When an ESL program exits, it no longer references the DLL and the operating system decrements a counter for the resources that are using the DLL. If the counter drops to zero, the DLL is unloaded from memory; otherwise it remains in memory because something else is still using it. A typical symptom of the DLL still being loaded is that you can't delete the .DLL file.

Here's an example:

Program A uses Fred.DLL and Tony.DLL

Program B uses Fred.DLL and Janet.DLL

If program A is loaded then ONLY Fred and Tony are loaded (assuming they've been called or are stimulus DLLs).

If program B is then loaded, then Fred, Tony, and Janet are loaded.

If program A exits, then ONLY Fred, and Janet are loaded. Tony.DLL will be unloaded since there are no resources still using it.

The key here is that you can't create a new DLL file with the same name if the DLL is still loaded because the operating system won't let you overwrite the file. Therefore, you must exit any ESL application before trying to rebuild or replace a DLL file.