Page 1 of 4

Migrating to Harbour

PostPosted: Thu Oct 03, 2013 6:20 pm
by Enrico Maria Giordano
Dear friends, I started again my experiment with Harbour. :-)

The first problem I encountered was the CreateObject() function, solved by linking xhb.lib and hbwin.lib.

Now a new problem: TRY/CATCH/END. Imagine you have one thousand PRGs. How to make them compilable with Harbour without spending the rest of your life in the effort? :-)

EMG

Re: Migrating to Harbour

PostPosted: Thu Oct 03, 2013 6:27 pm
by Rick Lipkin
Enrico

There is an include file for the Try\Catch .. I think it is HbCompat.ch .. something like that :(

Rick Lipkin

Re: Migrating to Harbour

PostPosted: Thu Oct 03, 2013 7:13 pm
by Badara Thiam
Enrico,

I can say you today « it's possible before the end of your life, but not sure. »

If your code have no needed CT TOOL3 functions and no GRAPHIC's functions
like Light Lib Graphic or Fern's Graphics Library, i think it's very little hard,
but this was not my chance... Fivewin was the Windows Lib i used, after tests
on Clip4Win, to help me to replace Dos graphics functions, with Clipper 5.3b and Blinker 7.

I not remember all the problems encountered. Very too much.
But i not support to let my prg to become obsolete.
I have writted or rewritted some hundred functions before to be able to generate
my first old Graphic Dos main menu under Windows without externals !

I don't know if it's simple today.

Re: Migrating to Harbour

PostPosted: Thu Oct 03, 2013 8:29 pm
by Enrico Maria Giordano
Rick,

Rick Lipkin wrote:Enrico

There is an include file for the Try\Catch .. I think it is HbCompat.ch .. something like that :(

Rick Lipkin


I already knew about hbcompat.ch but to use it I'd have to modify all my one thousand PRGs. :-)

I tried to add

Code: Select all  Expand view
#include "Hbcompat.ch"


to std.ch but strangely enough it looks like Harbour doesn't read std.ch... :?:

EMG

Re: Migrating to Harbour

PostPosted: Thu Oct 03, 2013 8:33 pm
by Enrico Maria Giordano
Badara,

Badara Thiam wrote:Enrico,

I can say you today « it's possible before the end of your life, but not sure. »

If your code have no needed CT TOOL3 functions and no GRAPHIC's functions
like Light Lib Graphic or Fern's Graphics Library, i think it's very little hard,
but this was not my chance... Fivewin was the Windows Lib i used, after tests
on Clip4Win, to help me to replace Dos graphics functions, with Clipper 5.3b and Blinker 7.

I not remember all the problems encountered. Very too much.
But i not support to let my prg to become obsolete.
I have writted or rewritted some hundred functions before to be able to generate
my first old Graphic Dos main menu under Windows without externals !

I don't know if it's simple today.


I used xHarbour since the very beginning. I'd just want to try Harbour now.

EMG

Re: Migrating to Harbour

PostPosted: Thu Oct 03, 2013 8:37 pm
by Badara Thiam
Migrate to Windows apps was very more complicated for me than, after, migrate to 32 bit with [x]Harbour.
With [x]Harbour the problem was to find CATOOLS III similars functions. Just found few ones.

Re: Migrating to Harbour

PostPosted: Thu Oct 03, 2013 8:53 pm
by Rick Lipkin
Enrico

I knew about the syntax difference in Try\Catch between xHarbour and Harbour and (like you) did not want to go through all my code to add HbCompat.ch.

I would like to try Harbour as well but I have way too many Try\Catch phrases myself... it would be nice if there was an easy solution... did you try adding hbCompat.Ch to FiveWin.ch ?

I am watching this thread with much interest.

Rick Lipkin

Re: Migrating to Harbour

PostPosted: Thu Oct 03, 2013 9:17 pm
by Enrico Maria Giordano
Rick,

Rick Lipkin wrote:Enrico

I knew about the syntax difference in Try\Catch between xHarbour and Harbour and (like you) did not want to go through all my code to add HbCompat.ch.

I would like to try Harbour as well but I have way too many Try\Catch phrases myself... it would be nice if there was an easy solution... did you try adding hbCompat.Ch to FiveWin.ch ?


For now I'm testing simple console mode samples but I'm pretty sure that adding hbcompat.ch to fivewin.ch will fix the problem.

Any ideas about console mode (ie. pure [x]Harbour samples, no FWH)?

EMG

Re: Migrating to Harbour

PostPosted: Thu Oct 03, 2013 9:32 pm
by Enrico Maria Giordano
I renamed std.ch and Harbour continue to compile commands like USE! :?: :?: :?:

I'm surely missing something...

EMG

Re: Migrating to Harbour

PostPosted: Thu Oct 03, 2013 9:34 pm
by Enrico Maria Giordano
I just tried the same with xHarbour and get the same result! Help please, I'm very confused now!

EMG

Re: Migrating to Harbour

PostPosted: Thu Oct 03, 2013 10:30 pm
by Lautaro
Hello,

Harbour not read std.ch file, harbour use a std.ch included in the compiler, for use std.ch you must be use switch /u+<file> in compiler script for include a new command file in the compilation.

Sorry for my bad english.


Atte.,

Lautaro

Re: Migrating to Harbour

PostPosted: Thu Oct 03, 2013 10:33 pm
by Enrico Maria Giordano
Lautaro,

Lautaro wrote:Hello,

Harbour not read std.ch file, harbour use a std.ch included in the compiler, for use std.ch you must be use switch /u+<file> in compiler script for include a new command file in the compilation.


Thank you for the info!

EMG

Re: Migrating to Harbour

PostPosted: Thu Oct 03, 2013 11:18 pm
by rhlawek
Perhaps this will help. Sorry for being verbose.

I use hbmk2 with .hbp and .hbm files for building everything I do, which has the added benefit of making it easy to use different compilers and move across platforms. I use msvc, both 32 and 64 bit, for regular work, but I can switch to any compiler seamlessly, as well as to Linux depending upon the features of an app. Please note that I don't take credit for this work Viktor Szakáts provided the original ideas, did all the hbmk2 work, and deserves a great deal of credit for his work. There is much more to hbmk2 than I've noted below.

For my VS2012 machine I use a batch file such as the following to set up the environment for building.

//hb32.bat
set PATH=c:\harbour\bin;%PATH%
cd c:\fwh\samples
call "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
start "Harbour 32 bit Environment"

Given hello.prg

procedure main()
? "Hello World!"
return

Compiling hello.prg then becomes:

hbmk2 hello.prg

If there are a number of prg files it could be:

hbmk2 hello.prg mod1.prg mod2.prg

If I have code with xharbour syntax, as follows, the hbcompat.ch file can be included on the build line without having to add it to each separate source, it gets included as would any standard header:

procedure main()
TRY
? "Hello World!"
CATCH
END
return

hbmk2 hello.prg hbcompat.ch

As for FWH, I started with harbour well before I ever used FWH and I had an established build environment already. I long ago ported the batch files FiveWin provides and put the libraries and paths referenced there within a single .hbm file, which I can use unchanged regardless of compiler being used, or platform. I've included below a version edited to match what FWH would normally install for 32 bits on Windows. I actually use a different directory structure than this to make it easier to deal with multiple compilers without having to maintain multiple build scripts. I'll be happy to share that, but I want to discuss it with Antonio offline first.

procedure main()
USE "customer.dbf" ALIAS cust
TRY
Browse()
CATCH
END
return

hbmk2 hello.prg hbcompat.ch c:\harbour\fwh.hbm

Below is the fwh.hbm file I use, but I've edited it to be usable with standard FWH paths, as the actual one I use conforms to harbour's standard library placement. One thing you will note is the libraries do not include the .lib extension. This is intentional and is done in all my build scripts because it makes them compiler agnostic, I don't change anything to go from msvc and its xhb.lib file to mingw and its xhb.a lib file. hbmk2 will actually warn about including extensions making things less portable.

You will notice I use forward slashes instead of back slashes for WIndows, it works and keeps things more compatible with my linux builds. These lines all start with {win}, which seems redundant if compiling on windows, but I use the same build files for linux, where they get prefixed by {linux} for the linux specific stuff...the linux tags are ignore on windows and vice versa. I've just not included them here to avoid confusing things.

// fwh.hbm

# Should be compatible with standard FWH 32 bit install.

# it's a multithreaded gui
-gui
-mt

-incpath=/fwh/include
-L/fwh/lib

# Harbour libraries required by FWH
{win}-lxhb
{win}-lhbct
{win}-lhbwin
{win}-lpng

# All FWH for windows
{win}-lFiveH
{win}-lFiveHC

# All Windows libraries required for FWH
{win}-lversion
{win}-lmsimg32
{win}-loledlg
{win}-lpsapi
{win}-lkernel32
{win}-luser32
{win}-lgdi32
{win}-lwinspool
{win}-lcomctl32
{win}-lcomdlg32
{win}-ladvapi32
{win}-lshell32
{win}-lole32
{win}-loleaut32
{win}-luuid
{win}-lodbc32
{win}-lodbccp32
{win}-liphlpapi
{win}-lmpr
{win}-lwsock32
{win}-lgdiplus
{win}-lwinmm
{win}-lWS2_32

// fwh.hbm - eof.

Best regards,

Robb

Re: Migrating to Harbour

PostPosted: Fri Oct 04, 2013 6:45 am
by Maurizio
Ciao Enrico

Did you read c:\Harbour\doc\xhb-diff.txt ?

Maurizio
www.nipeservice.com

Re: Migrating to Harbour

PostPosted: Fri Oct 04, 2013 8:27 am
by Enrico Maria Giordano
Robb,

thank you. I'd prefer to keep using my compile batch. There are no problems in using /u+ to add hbcompat.ch to the default definition files. I just wanted to know if Harbour crew had provided an implicit definition for TRY/CATCH/END. Now I understood that they hadn't. :-(

EMG