In reply to dave_59:
Thanks for your reply, dave.
That is one way to fix this. It seems that all the places using that static valuable need to use its own copy.
Because the posted code is an simplified example, so we can easily to change it in two functions where it is called. In real case, a lot of dependencies in C side on that static variable. If it is changed, it means a lot of work need to be done for that change. Is there a mechanism that allow to dynamically change static to dynamic in run-time?