I am using /MD compiler option to build my executables.
The executable contains a static variable "lib_ref_count" which is initialised to zero at start of code. I use Flexlm library a third party library along with my own built library say "test.lib" in my application.
Before trying to call any function of my library "test.lib",
I first initialise the library reference count in "lib_ref_count" say "lib_ref_count = 1". Only when this count > 0 say "lib_ref_count > 0", I can allow the call to any function in my library "test.lib". The problem i am facing now is the static variable "lib_ref_count" gets properly initialised to "1" but suddenly becomes zero after a call to function of Flexlmlibrary. Hence any function call to "test.lib" after this fails.
Can anyone just explain me what might be the actual cause of this problem and how to overcome this?

with regards,