Generate access to internal state in shared libs