Start a new topic

mgInit() after mgExit()

Original Post by: perezucf Tue Feb 11 22:58:00 2014


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.


Original Post by: SteveThompson Tue Feb 11 23:09:26 2014


You can call mgInit (and mgExit) only one time per process. So instead of

mgInit

mgOpenDb

mgCloseDb

mgExit


mgInit

mgOpenDb

mgCloseDb

mgExit


...

you should:

mgInit


mgOpenDb

mgCloseDb


mgOpenDb

mgCloseDb


...


mgExit


Original Post by: perezucf Wed Feb 12 00:19:44 2014


Ok that's fine. Is there a way to tell if mgInit has already been called?

Original Post by: SteveThompson Wed Feb 12 00:44:18 2014


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.

Login to post a comment