You can call mgInit (and mgExit) only one time per process. So instead of
mgInit
mgOpenDb
mgCloseDb
mgExit
mgInitmgOpenDb
mgCloseDb
mgExit
...
you should:
mgInit
mgOpenDbmgCloseDb
mgOpenDbmgCloseDb
...
mgExit
Ok that's fine. Is there a way to tell if mgInit has already been called?
There is no function you can call in the API that will tell you mgInit has been called. You'll have to keep track of that yourself. Easy enough to do with a global singleton or something like that.
Craig
If I call mgInit(), open a db then close it then call mgExit() and at some point after call mgInit() again I get access violations when I try a call to mgOpenDB(). Should that work? It is not clear from the documentation.