FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Script Question
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Script Question
Posted: Thu Apr 19, 2018 08:37 PM
I am using the scripts ability with harbour and FWH via the Execute(code) function.

I get an error when I try to use the FileCopy() function in my program (see code below).
Any ideas why I get this error: "Error description: Error BASE/6101 Unknown or unregistered symbol: FILECOPY"

I get the error with other functions as well (like HB_Base64Encode() )

Code (fw): Select all Collapse
#include "FiveWin.ch"
#define CRLF CHR(13)+CHR(10)

Function MainTest()
   
   cText:= "#include 'Fivewin.ch'"+CRLF
   cText += "Function Main()"+CRLF
   cText += "   FileCopy( 'c:\test\FileA.txt', 'c:\test\FileB.txt' )"+CRLF
   cText += "Return Nil"
   Execute( cText )
Return Nil

function Execute( cCode, ... )
   local oHrb, cResult, bOldError, uRet
   local cFWheaders := "c:\FWH1611\include" 
   local cHBheaders := "c:\harbour\include" 

   oHrb = HB_CompileFromBuf( cCode, "-n", "-I" + cFWheaders, "-I" + cHBheaders )
   if ! Empty( oHrb )
      BEGIN SEQUENCE
         uRet = hb_HrbDo( hb_HrbLoad( oHrb ), ... )
      END SEQUENCE
   endif
return uRet
Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Script Question
Posted: Thu Apr 19, 2018 09:04 PM
Maybe this function is not included in your exe.

Try to include an EXTERNAL FileCopy in your main program.
Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Script Question
Posted: Thu Apr 19, 2018 09:15 PM

Thank you, that fixed it :D

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM
Re: Script Question
Posted: Fri Apr 20, 2018 01:51 PM

Jeff,

I am curious, what is the advantage of compiling code such as this to .hrb vs just making the call to FileCopy() directly? I realize FileCopy() here is likely just an example, but I'm trying to understand the why of this.

Robb

Posts: 933
Joined: Sun Oct 09, 2005 01:05 PM
Re: Script Question
Posted: Fri Apr 20, 2018 02:03 PM

Hi Robb,

I have an application that is sending HL7 result messages back to the hospital main system.
This app can have multiple "sites" and each site typically requires slight differences in the result message.
What I've done is create a result.prg file with the basic info for a result message for each site.
Then I can simply modify the result.prg per site to make the slight changes.
This allows me to keep my "main" code the same for everyone but still allow for changes in code without any rebuilding of the app.
If a customer requires a change to the result message later on, I can make the changes to the result.prg file without any downtime for the users.

Thanks,

Jeff Barnes



(FWH 16.11, xHarbour 1.2.3, Bcc730)
Posts: 1067
Joined: Wed Nov 09, 2005 02:17 AM
Re: Script Question
Posted: Fri Apr 20, 2018 02:10 PM

I think HRB is amazing !!
We have a very big application, with more than 400 modules and its EXE has only 7Mb, thanks to HRB files ;)

Sds,
Vilian F. Arraes
vilian@vfatec.com.br
Belém-Pa-Brazil
Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM
Re: Script Question
Posted: Fri Apr 20, 2018 02:18 PM

Thank you for the reply Jeff.

Vilian, I didn't mean to imply there was an issue using HRB, I use them as well, but never quite in this context. I actually write my programs so I have a basic executable (completely functional but very dynamic), then serve all the program logic up to those executables as portable objects via a REST service.

Robb

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Script Question
Posted: Fri Apr 20, 2018 06:07 PM

Robb,

The ability to compile and execute code at runtime is the essence of the ERP applications: applications that grow and adapt to the needs of each customer without having to build new EXEs for each one.

You can turn any app into a powerful ERP system just using this technique :-)

No need to build HRB files. Simply compile and execute at runtime using hb_CompileFromBuff(). I recently posted how to catch the compiler reported errors.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 195
Joined: Sun Jul 22, 2012 07:01 PM
Re: Script Question
Posted: Fri Apr 20, 2018 06:19 PM

Antonio,

Isn't there a license constraint for distributing a non-open source app containing and using hb_CompileFromBuff()?

Robb

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Script Question
Posted: Fri Apr 20, 2018 06:47 PM

Robb,

The way I see it is that if there is someone that ask you to show your source code, you should provide it. Thats all.

regards, saludos

Antonio Linares
www.fivetechsoft.com

Continue the discussion