I would also add one file to the include/ folder
But I can't remember how to add files to the repository :-(
Any help welcome :-)
J. Lefebvre
In the meantime, I can send the three files to anyone willing to do so for me
:-)
PS: at this time, using HB_HRB_KEEP_GLOBAL will disable HB_HRBUNLOAD().
I could add some structure to track loading unloading later, but from now I'm a
bit too charged by a big project.
Regards,
Hbhrb.ch
#define HB_HRB_DEFAULT 0 // do not overwrite any functions, ignore
// public HRB functions if functions with
// the same names already exist in HVM
#define HB_HRB_KEEP_LOCAL 1 // do not overwrite any functions
// but keep local references, so
// if module has public function FOO and
// this function exists also in HVM
// then the function in HRB is converted
// to STATIC one
#define HB_HRB_KEEP_GLOBAL 2 // overload all existing public functions
// will disable HB_HRBUNLOAD()
And two test files under tests/
Testhrb.prg
/*====================================================================== */
#include "hbhrb.ch"
Procedure Main(x)
Local pHrb, cExe := "Msg2()", n
n:=iif(x==NIL,0,val(x))
? "calling Msg ... From exe here !"
Msg()
? "========================="
// ? "Loading('Exthrb.hrb' )"
// pHrb := hb_HrbLoad("Exthrb.hrb" )
// ? "Loading(HB_HRB_DEFAULT,'Exthrb.hrb' )"
// pHrb := hb_HrbLoad(HB_HRB_DEFAULT,"Exthrb.hrb" )
// ? "Loading(HB_HRB_KEEP_LOCAL,'Exthrb.hrb' )"
// pHrb := hb_HrbLoad(HB_HRB_KEEP_LOCAL,"Exthrb.hrb" )
?
"Loading("+iif(n=0,"HB_HRB_DEFAULT",iif(n=1,"HB_HRB_KEEP_LOCAL","HB_HRB_KEEP_GLOBAL"))+",'Exthrb.hrb'
)"
pHrb := hb_HrbLoad(n,"Exthrb.hrb" )
? "========================="
? "calling Msg ... DEFAULT=From exe, LOCAL=From exe, GLOBAL=From HRB"
Msg()
? "========================="
? "calling Msg ... DEFAULT=From exe, LOCAL=From HRB, GLOBAL=From HRB"
&cExe //
? "========================="
hb_HrbUnload( pHrb ) // should do nothing in case of GLOBAL
? "calling Msg ... DEFAULT=From exe, LOCAL=From exe, GLOBAL=From HRB"
Msg() // test unload protection when using GLOBAL ... then Hrb not anymore
unloadable
? "========================="
? "END"
Return
Function Msg()
? "Function called from Exe"
Return .T.
/*====================================================================== */
Exthrb.prg
Function Msg()
? "Function called from HRB file"
Return .T.
Function msg2()
Return Msg()
/*====================================================================== */
_______________________________________________
Harbour mailing list
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour