Currently, it's not possible to have multiple instances of libpostal in one process. Even worst, if you want to change the datadir, you're changing it for everything. It also brings multithreading conflicts. Wouldn't it be possible to returns objects and expect this object in all functions using this object instead?
Having an instance for each kind would prevent all the previously mentioned issues but would also make it more clear in the API which function is using which initializer.
What do you think?
PS: it would pretty simple to prevent freeing a context whereas some children of this context are still running. For example, not being able to use libpostal_setup as long as all "children" generated by libpostal_setup_parser or libpostal_setup_language_classifier are not freed.