Ada DLLs and Finalization (GNAT User’s Guide for Native Platforms)

#### 7.4.8.16 Ada DLLs and Finalization ¶

When the services of an Ada DLL are no longer needed, the client code should invoke the DLL finalization routine, if available. The DLL finalization routine is in charge of releasing all resources acquired by the DLL. In the case of the Ada code contained in the DLL, this is achieved by calling routine `adafinal` generated by the GNAT binder (Binding with Non-Ada Main Programs). See the body of `Finalize_Api` for an example. As already pointed out the GNAT binder is automatically invoked during the DLL build process by the `gnatdll` tool (Using gnatdll).