API lifetime#
Primary ItalaApi functionalities are accessible via an abstraction called system, which is the root of the API. To initialize the ItalaApi, the client code must create the system instance.
Warning
The client code is responsible for the system instance lifetime. The client code must create the system before using it and destroy it when it’s no longer required. As long as the system instance is alive, the ItalaApi can be used.
The CreateSystem
free function initializes ItalaApi and returns a pointer to the system interface itala.itala.ISystem
. The itala.itala.IDisposable.dispose()
function of the itala.itala.ISystem
interface works exactly like a delete operator: it destroys the system instance.
from itala import itala
system = itala.create_system()
# Use the ISystem interface
system.dispose()
It’s good practice to set the itala.itala.ISystem
pointer to null after the system instance is destroyed to avoid double itala.itala.IDisposable.dispose()
calls and other memory corruption problems.
Since the system is the root of the API, it is unique and only one instance can be created at a time.