Hello Przemek

Here is what I am having in my applactions:

static aMacros

Function Main()
   Local aStrings, i

   DefinePublics()

   aStrings := { 'pz1', 'pz2' }
   for i := 1 to len( aStrings
      aadd( aMacros, &( '{|v,w,x,y,z|' + aStrings[ i ] + '}' ) )
   next
   
   pz1 := 4000

   do while .t.
      nKey := inkey()
      if nKey == 27 
         exit
      endif
      if nKey == K_ALT_7
         hb_threadStart( {|| MyThreadFunc() } )
      endif
   enddo

   return nil

Function DefinePublics()

   PUBLIC pz1, pz2

   RETURN NIL

Function MyThreadFunc()
   Local xRes

   // Redefine Public Variables - I want another sets in any new thread
   DefinePublics()
    
   xRes := eval( aMacros[ 1 ] )   
   ? xRes  // 4000

   // QUESTION : pz1 is initialized in main thread and re-public(d) in
another thread
   //                  because macro is compiled in main thread, pz1
referenced is from main thread
   //
   //          IS IT POSSIBLE THAT MACROS COMPILED IN ANYWHERE SHOULD REFER
TO REDEFINED
   //          IN ANOTHER THREAD ?
   //
   //          Though I have a very limited number of publics in my
applications and I use the 
   //          above construct heavily, I am finding it difficuly how to
solve this issue.

   Return NIL


Regards
Pritpal Bedi  
-- 
View this message in context: 
http://www.nabble.com/MT---Macro-compiled-blocks-and-variables-scope-tp24060063p24060063.html
Sent from the Harbour - Dev mailing list archive at Nabble.com.

_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to