Viktor Szakáts wrote: > > Why not add an explicit init function to reinit that > variable whenever you need it? > OK I may add extra init function (And MUST remember write it), but why, if it already exists function HB_FUNC_INITSTATICS(). The problem is that it is invoked only once. That behavior is very confusing. Sample, first men wirte module: *** mod1.prg -> mod1.hrb *** FUNTION ABC() STATIC x:=99 ++x RETURN x ***** and second men write module: **** mod2.prg -> mod2.hrb FUNCTION ABC() // SAME NAME !!! STATIC y:=59 // NOT X but Y !!! y++ RETURN y ****** Now I in my MAINPROGRAM get from script names of modules and functions and do: ******* h:=HB_HRBLOAD(module1) // "mod1.hrb" ? &(funcname1) // "abc()" -> 100 OK ? &(funcname1) -> 101 OK HB_HRBUNLOAD(h) // same code h:=HB_HRBLOAD(module2) // "mod2.hrb" ? &(funcname2) // "abc()" -> 102 !?! ? &(funcname2) -> 103 !?! HB_HRBUNLOAD(h) ********
> IMO it's not the job of HRB engine to solve such programming tasks. > Such setting has not much point > anyway as you may have multiple STATIC vars with > different init requirement inside on .hrb. Moreover > it makes your code dependent on the way its > invoked/loaded. > But just to add an option that every time you load the module HRB will perform the functions HB_FUNC_INITSTATICS(). Adam -- View this message in context: http://old.nabble.com/STATIC-variables-in-HRB-and-PCODE-DLL-tp26315403p26319000.html Sent from the Harbour - Dev mailing list archive at Nabble.com. _______________________________________________ Harbour mailing list (attachment size limit: 40KB) Harbour@harbour-project.org http://lists.harbour-project.org/mailman/listinfo/harbour