The task is to create dynamically linked library, which encapsulates database hard work. Due to some design limitations I have a defined interface, which consist of numerous functions. Each function takes a parameters and use them in database query. Database connection should be inside dll and application don't want to bother is there any connection.
What is the best way to initialize db connection and then give it to every function without passing it around explicitly.
Of course in general I'd like to use State monad. But dll is not provided to have one entry point.