Script Question

Post Reply
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Script Question

Post by Jeff Barnes »

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: Select all

#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 12.01, xHarbour 1.2.1, Bcc582)
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: Script Question

Post by vilian »

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
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: Script Question

Post by Jeff Barnes »

Thank you, that fixed it :D
Thanks,
Jeff Barnes

(FWH 12.01, xHarbour 1.2.1, Bcc582)
User avatar
rhlawek
Posts: 165
Joined: Sun Jul 22, 2012 7:01 pm

Re: Script Question

Post by rhlawek »

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
User avatar
Jeff Barnes
Posts: 912
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada
Contact:

Re: Script Question

Post by Jeff Barnes »

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 12.01, xHarbour 1.2.1, Bcc582)
User avatar
vilian
Posts: 795
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil
Contact:

Re: Script Question

Post by vilian »

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
User avatar
rhlawek
Posts: 165
Joined: Sun Jul 22, 2012 7:01 pm

Re: Script Question

Post by rhlawek »

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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Script Question

Post by Antonio Linares »

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
User avatar
rhlawek
Posts: 165
Joined: Sun Jul 22, 2012 7:01 pm

Re: Script Question

Post by rhlawek »

Antonio,

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

Robb
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Script Question

Post by Antonio Linares »

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
Post Reply