#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    3
    Rep Power
    0

    Problem with static variable


    Hai,
    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,
    Karthik.
  2. #2
  3. Contributing User

    Join Date
    Aug 2003
    Location
    UK
    Posts
    5,112
    Rep Power
    1803
    Sounds like an bounds check problem. If you pass a pointer to a function, and that function writes to the data pointed to but writes beyond the intended bounds, then it is likely that it will corrupt adjacent data in the calling function. Check the parameters you are passing to the FlexLM function, especially the size and type of any parameters you are passing. You really need to post the code for more help than that, including all data declarations, and the prototype for the FlexLM function you are calling.

    Clifford
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    3
    Rep Power
    0

    Talking Thnx Man......


    Hai,
    Thnx a lot...It worked well..I initialised all members passed to the third party library. It is working now..Gr8..
    -Karthik.

IMN logo majestic logo threadwatch logo seochat tools logo