I am developing a Delphi application using a OCCT through a wrapper DLL with c-style exports.
While this approach works reasonably well, i have some issues with deinitializing the OCCT-Modules.
The application ( a construction/calculation suite for architectural engineering) is using OCCT for modeling and export of 3d-assemblies from paramters stored in it's database, so the OCCT-module is not needed permanently.
the typical workflow is:
- Generate construction
- Load Wrapper Dll
- initalize a viewer
- model the construction as an OCCT-Assembly
- Export to file
- unload wrapper DLL
The wrapper DLL is loaded dynamically, but is itself load-time-linked to the OCCT libraries using the lib files and headers provided by the OpenCascasde installation.
After the unloading the wrapper dll, some (but not all) of the Opencascade dlls stay loaded into my processes memory space. I experimented wiht delay-loading and explicitly unloading the libraries, but had no change in behaviour.
This wouldn't be so bad since the dlls are unloaded once my application process terminates. BUT, when the application starts generation and modeling of second construction, it crasges or freezes, either during the initialization of a new viewer, or when modeling the required shapes.
I would guess that some of the TK*.dlls have internal states which I don't reset when unloading my wrapper. Could anyone give me some hints as how to truly unload all OCCT components from my process?