From: William Djaja Tjokroaminata Date: 2002-08-06T00:39:10+09:00 Subject: What Is the Rule to Declare Global Variables? Hi Guy, Thanks for the assertion. After reading the code again, it is the same old problem: some of the global variables have not been taken care of by either "rb_global_variable", "rb_define_readonly_variable", or "rb_define_variable". The only tricky part is, the code has been working for so long, and only much later that the problem appears. Now I am wondering, what is the rule to protect the global variables? Do ALL C VALUE global variables have to be protected as above? Or, ALL, except: - variables that have been used in "rb_define_module..." - variables that have been used in "rb_define_class..." - (others?) On the other hand, if we protect such variables, will it result in segmentation fault instead? Or is it OK to "overprotect" them? (Is it similar to the C's problem of is it OK to free a variable that has been freed?) In the pick-axe book such variables are not protected. Currently I don't protect them either. However, because of these two experiences, I don't know whether I have done the right thing or not, because the problem may appear in the future, when I just add another function call, which will lead me to believe that the problem occurs because of the newly added code. Thanks. Regards, Bill ============================================================================ ts wrote: > You have a bug. Post your source or nobody will be able to help you > Guy Decoux