Yes, that's the module I'm experimenting with.
Yes, that's the module I'm experimenting with.
__mvSetBase()
This is a hacking function which changes base private offset so PRIVATE variables created in function which calls __mvSetBase()
will not be released when the function exit but will be inherited by its caller.
Function sa_1()
sa_2()
? cTXT
Return .T.
Function sa_2()
Private cTXT:="CIAO"
__mvSetBase() // importante
Return .T.
Thank you, but I need it for xHarbour (please read the whole thread).
this is the function code in "memvars.c" of Harbour
HB_FUNC( __MVSETBASE )
{
HB_STACK_TLS_PRELOAD
HB_ISIZ nOffset = hb_stackBaseProcOffset( 0 );
if( nOffset > 0 )
hb_stackItem( nOffset )->item.asSymbol.stackstate->nPrivateBase =
hb_memvarGetPrivatesBase();
}
Thank you but, please, read the whole thread. We have already discussed that code.
FUNCTION MAIN()
  LOCALE cName:=""
  cName:= CREATEVAR( cName, "Hello" )
  ? cName // it exists here
  RETURN NIL
STATIC FUNCTION CREATEVAR( cName, xValue )
  cName:= xValue
RETURN xValue