Page 2 of 3
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Nov 02, 2007 9:40 am
by Antonio Linares
There are some differences between Harbour and xHarbour.
Harbour hb_compileBuf() is very powerfull as no external Harbour.exe is required. xHarbour should provide it.
Also, as you have seen, __HrbRun() is a little different too. But using it with HRB files from disk, they will behave the same.
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Nov 02, 2007 10:38 am
by nageswaragunupudi
In xharbour ,
we can do :
- Code: Select all Expand view
__HrbRun( <file.hrb> )
// or
cHrb := memoread( "file.hrb" )
pBody := __hrbload( cHrb ) // __hrbload( "file.hrb" ) also works
// pBody is pointer variable
__hrbdo ( pBody )
// or we can make a small function
FUNCTION XHRBRUN ( cSource ) // can be file on disk or buffer in memory
RETURN __HrbDo( __HrbLoad( cSource ) )
// note: this is from the sourc of ver 99.70
// works with ver 99.71
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Nov 02, 2007 10:42 am
by Antonio Linares
NageswaraRao,
Better rename cSource as cHRBFileName to avoid confusions, thanks
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Nov 02, 2007 11:03 am
by nageswaragunupudi
Yes thanks. I forgot to unload the pointer.
- Code: Select all Expand view
FUNCTION xHrbRun( cHRBfileNameOrcHRBCode )
LOCAL pHrb
__HrbRun( pHrb := __HrbLoad( cHRBfileNameOrcHRBCode ) )
__HrbUnload( pHrb )
RETURN NIL
// Note: arguments support still to be added
The above function can be used for .hrb file on disk or hrb compiled code in memory ( ideal for storing in database and execute retrieved code )
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Nov 02, 2007 4:25 pm
by Rimantas
Antonio Linares wrote:My mistake, you can directly execute it from memory too
![Smile :-)](./images/smilies/icon_smile.gif)
__HrbRun( MemoRead( "another.hrb" ) )
Thanks for the samples and explanations , Antonio . I'll tried that . Only one question - can we use FWH syntax in this externals prgs ? That's the "another.prg" can contain DIALOG , BUTTONS , GET in FWH syntax ? Also it's one important - will that suport native class ? I'm using xHarbour Bcc ...
With best regards ! Rimantas
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Nov 02, 2007 4:51 pm
by Rimantas
nageswaragunupudi wrote:Yes thanks. I forgot to unload the pointer.
- Code: Select all Expand view
FUNCTION xHrbRun( cHRBfileNameOrcHRBCode )
LOCAL pHrb
__HrbRun( pHrb := __HrbLoad( cHRBfileNameOrcHRBCode ) )
__HrbUnload( pHrb )
RETURN NIL
// Note: arguments support still to be added
The above function can be used for .hrb file on disk or hrb compiled code in memory ( ideal for storing in database and execute retrieved code )
Always get error :
- Code: Select all Expand view
Application
===========
Path and name: C:\A\AMDI\eng32.exe (32 bits)
Size: 2,767,360 bytes
Time from start: 0 hours 0 mins 7 secs
Error occurred at: 2007.11.02, 18:43:23
Error description: Error BASE/9999 Corruption detected: __HRBLOAD
Args:
Stack Calls
===========
Called from: => __HRBRUN(0)
Called from: ENG32.PRG => XHRBRUN(2190)
Called from: ENG32.PRG => TAPPLIC:SCRPT(1819)
Called from: ENG32.PRG => (b)TAPPLIC:BUILDBAR(691)
Called from: btnbmp.prg => TBTNBMP:CLICK(0)
Called from: btnbmp.prg => TBTNBMP:LBUTTONUP(0)
Called from: window.prg => TWINDOW:HANDLEEVENT(0)
Called from: control.prg => TBTNBMP:HANDLEEVENT(0)
Called from: window.prg => _FWH(0)
Called from: => WINRUN(0)
Called from: window.prg => TMDIFRAME:ACTIVATE(0)
Called from: ENG32.PRG => TAPPLIC:ACTIVATE(344)
Called from: ENG32.PRG => MAIN(109)
What I'm doing bad ?
Regards ! Rimantas
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Nov 02, 2007 5:21 pm
by Antonio Linares
Rimantas,
>
Only one question - can we use FWH syntax in this externals prgs ? That's the "another.prg" can contain DIALOG , BUTTONS , GET in FWH syntax ? Also it's one important - will that suport native class ? I'm using xHarbour Bcc ...
>
Yes
![Smile :-)](./images/smilies/icon_smile.gif)
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Nov 02, 2007 5:27 pm
by Antonio Linares
Rimantas,
Please try the test I posted
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Nov 02, 2007 6:43 pm
by Rimantas
Antonio Linares wrote:Rimantas,
Please try the test I posted
Thanks Antonio ! Your test is working - simply __HbRun() . Also I tried with __HbRun( MemoRead( cFile ) ) - it return the same error "Corupption detected __HbLoad" . It seems that works only HbRun ...
Many thanks Antonio , it seems that you directed me to true way ...
![Smile :-)](./images/smilies/icon_smile.gif)
With best regards ! Rimantas
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Nov 02, 2007 8:32 pm
by James Bott
__HrbRun( MemoRead( "another.hrb" ) )
I'm confused. What is in an .HRB file? Is it simply FW code? If so, then could we just read a PRG? Any PRG?
__HrbRun( MemoRead( "another.prg" ) )
James
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Nov 02, 2007 10:26 pm
by Antonio Linares
James,
> What is in an .HRB file?
HRB is a binary file (not ascii) that contains some specific Harbour information (pcode, symbols table).
Its called "Harbour portable file" as theoretically could be executed on any operating system, as it does not include any operating system related info.
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sat Nov 03, 2007 1:28 pm
by nageswaragunupudi
Does any one know the equivalent of Harbour's hb_compileBuf() in xHarbour please?
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sat Nov 03, 2007 1:38 pm
by Antonio Linares
afaik, it is not implemented in xharbour
![Sad :-(](./images/smilies/icon_sad.gif)
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Sat Nov 03, 2007 3:36 pm
by nageswaragunupudi
Sad. Missing a really powerful and very useful function.
Re: Scripting ...
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Mon Jul 01, 2024 4:31 pm
by jair
cFilePrg := "myprg.prg"
__Run( "harbour "+cFilePrg+" -i -gh -m -n -b " )
Estoy probando generar la compilación hrb para poder compilar un archivo hrb ahora para ejecutar este archivo como si fuera un archivo ejecutable de otro archivo ejecutable. ¿Alguien sabe o tiene alguna idea?