Script Question

Script Question

Postby Jeff Barnes » Thu Apr 19, 2018 8: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: Select all  Expand view  RUN

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

Re: Script Question

Postby vilian » Thu Apr 19, 2018 9: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
User avatar
vilian
 
Posts: 982
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Script Question

Postby Jeff Barnes » Thu Apr 19, 2018 9:15 pm

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

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 933
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Script Question

Postby rhlawek » Fri Apr 20, 2018 1: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
User avatar
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm

Re: Script Question

Postby Jeff Barnes » Fri Apr 20, 2018 2: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)
User avatar
Jeff Barnes
 
Posts: 933
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Script Question

Postby vilian » Fri Apr 20, 2018 2: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
User avatar
vilian
 
Posts: 982
Joined: Wed Nov 09, 2005 2:17 am
Location: Brazil

Re: Script Question

Postby rhlawek » Fri Apr 20, 2018 2: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
User avatar
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm

Re: Script Question

Postby Antonio Linares » Fri Apr 20, 2018 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Script Question

Postby rhlawek » Fri Apr 20, 2018 6:19 pm

Antonio,

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

Robb
User avatar
rhlawek
 
Posts: 194
Joined: Sun Jul 22, 2012 7:01 pm

Re: Script Question

Postby Antonio Linares » Fri Apr 20, 2018 6: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
User avatar
Antonio Linares
Site Admin
 
Posts: 42203
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 81 guests