WinFakt! - (7763 of 826972 - 1%) 

 Home | Tips & Tricks | General Info | Downloads | NG Archive | Links | Email | Search | Register | Users | Login

 


 

Tips & Tricks

 

Rating: 80% (6 votes registred)
Rate this item:

Back to list

A guide for go from Clipper to Harbour

How to convert from FiveWin 16 BIT to Harbour

How to convert from FiveWin 16 BIT to Harbour

 

Here you find some of my experiences when I was converting my first application to Harbour. It was working at my place and it fitted in my system.

 

My native tongue is Dutch. My English is not good, so everybody is welcome to send me a version with language corrections.

 

I am not a Harbour guru. I am just a beginner. So gurus are also welcome to make corrections and send them to me.

 

The only goal of this is to make it easier to other beginners to make the big step to Harbour. I can give you no warranty and I hope it will be helpful.

 

Success

 

Willy Hermans.

HW.Soft@Pandora.Be

1.    Directory structure

Here the structure of my Harbour dev center. It is just one way. Of course there are other structures but the rest of this text is based upon it.

 

C:\HB

Root of Harbour system

C:\HB\C550

Borland C Dir

C:\HB\CH

All header files .CH .H

This makes the make file more readable for a beginner

C:\HB\DOC

All my documentation

C:\HB\FW23

The FW23 Dir

FiveWin for Harbour is also installed after FwH

C:\HB\GRAPHICS

All kind of bitmaps

C:\HB\HARBOUR

Build 40

Can be replaced by the xHarbour files.

Does not forget to update also the c:\HB\CH dir

C:\HB\PROJECT

Contains a subdir for every Harbour project

C:\HB\RADWIN

My own Rapid Application Developer

C:\HB\TSBROWSE

Manuel Mercado’s TsBrowse

 

 

 

2.    Make File “ Go.Mak”

 

This is a working example that I use in every project. The yellow marked area’s has to be replaced. The black text is a matrix the blue text is completely filled in.

 

The blue marked area contains the .LIB files. If you are using other LIBs mention them here.

 

The green marked area contains the name of the RC file made by Workshop.

 

#BCC

VERSION=BCB.01

!ifndef BCB

BCB = $(MAKEDIR)

!endif

 

!ifndef BHC

BHC = $(HMAKEDIR)

!endif

 

FWH = c:\hb\FW23

OBJ = obj

PROJECT = ôProjectNameõ $(PR)

 

OBJFILES = ôOBJõ $(OB)

 

PRGFILES = ôPRGõ $(PS)

 

OBJCFILES = $(OB)

CFILES = $(CF)

RESFILES = Aquarius

RESDEPEN = $(RESFILES)

LIBFILES = c:\Hb\Fw23\lib\fiveh.lib c:\Hb\Fw23\lib\fivehc.lib lang.lib vm.lib rtl.lib rdd.lib macro.lib pp.lib dbfntx.lib dbfcdx.lib common.lib gtwin.lib rddads.lib ace32.lib sbrowseh.lib btnget.lib

DEFFILE =

HARBOURFLAGS =  -a  -w  -

CFLAG1 =  -OS $(CFLAGS) -d -L$(BHC)\lib;$(FWH)\lib -c

CFLAG2 =  -Ic:\Hb\Ch

RFLAGS =

LFLAGS = -L$(BCB)\lib\obj;$(BCB)\lib;$(BHC)\lib;c:\Hb\Fw23\lib -Gn -M -m -s -aa-Tpe

IFLAGS =

LINKER = ilink32

 

ALLOBJ = c0w32.obj $(OBJFILES) $(OBJCFILES)

ALLRES = $(RESFILES)

ALLLIB = $(LIBFILES) import32.lib cw32.lib

.autodepend

 

#COMMANDS

.cpp.obj:

$(BCB)\BIN\bcc32 $(CFLAG1) $(CFLAG2) -o$* $*

 

.c.obj:

$(BCB)\BIN\bcc32 -I$(BHC)\include $(CFLAG1) $(CFLAG2) -o$* $**

 

.prg.obj:

c:\Hb\Harbour\bin\harbour -n -go -Ic:\Hb\Ch -a -v  $**

 

.rc.res:

$(BCB)\BIN\brcc32 $(RFLAGS) $<

 

#BUILD

 

$(PROJECT): $(CFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE)

    $(BCB)\BIN\$(LINKER) @&&!

    $(LFLAGS) +

    $(ALLOBJ), +

    $(PROJECT),, +

    $(ALLLIB), +

    $(DEFFILE), +

    $(ALLRES)

!

 

#BCC

VERSION=BCB.01

!ifndef BCB

BCB = $(MAKEDIR)

!endif

 

!ifndef BHC

BHC = $(HMAKEDIR)

!endif

 

FWH = c:\hb\FW23

OBJ = obj

PROJECT = Aquarius $(PR)

 

OBJFILES = Aquarius.obj about.obj Ads.obj Artikel.obj ArtVerk.obj Bevoeg.obj Bst.obj Central.obj Coef.obj Config.obj DataStak.obj Divers.obj Isabel.obj Kasboek.obj Klant.obj KlTmp.obj Lev.obj LevBon.obj LoFoTab.obj menu.obj Open.obj OpenDbf.obj Order.obj ParMaand.obj Post.obj Prescrib.obj Prt.obj PrtDagBk.obj RadLib.obj Rek.obj ShowArry.obj Stat.obj StdTxt.obj User.obj Verkoop.obj Verteg.obj Zoek.obj Ond.obj  $(OB)

 

PRGFILES = Aquarius.Prg about.Prg Ads.Prg Artikel.Prg ArtVerk.Prg Bevoeg.Prg Bst.Prg Central.Prg Coef.Prg Config.Prg DataStak.Prg Divers.Prg Isabel.Prg Kasboek.Prg Klant.Prg KlTmp.Prg Lev.Prg LevBon.Prg LoFoTab.Prg menu.Prg Open.Prg OpenDbf.Prg Order.Prg ParMaand.Prg Post.Prg Prescrib.Prg Prt.Prg PrtDagBk.Prg RadLib.Prg Rek.Prg ShowArry.Prg Stat.Prg StdTxt.Prg User.Prg Verkoop.Prg Verteg.Prg Zoek.Prg Ond.Prg  $(PS)

 

OBJCFILES = $(OB)

CFILES = $(CF)

RESFILES = Aquarius

RESDEPEN = $(RESFILES)

LIBFILES = c:\Hb\Fw23\lib\fiveh.lib c:\Hb\Fw23\lib\fivehc.lib lang.lib vm.lib rtl.lib rdd.lib macro.lib pp.lib dbfntx.lib dbfcdx.lib common.lib gtwin.lib rddads.lib ace32.lib sbrowseh.lib btnget.lib

DEFFILE =

HARBOURFLAGS =  -a  -w  -

CFLAG1 =  -OS $(CFLAGS) -d -L$(BHC)\lib;$(FWH)\lib -c

CFLAG2 =  -Ic:\Hb\Ch

RFLAGS =

LFLAGS = -L$(BCB)\lib\obj;$(BCB)\lib;$(BHC)\lib;c:\Hb\Fw23\lib -Gn -M -m -s -aa-Tpe

IFLAGS =

LINKER = ilink32

 

ALLOBJ = c0w32.obj $(OBJFILES) $(OBJCFILES)

ALLRES = $(RESFILES)

ALLLIB = $(LIBFILES) import32.lib cw32.lib

.autodepend

 

#COMMANDS

.cpp.obj:

$(BCB)\BIN\bcc32 $(CFLAG1) $(CFLAG2) -o$* $*

 

.c.obj:

$(BCB)\BIN\bcc32 -I$(BHC)\include $(CFLAG1) $(CFLAG2) -o$* $**

 

.prg.obj:

c:\Hb\Harbour\bin\harbour -n -go -Ic:\Hb\Ch -a -v  $**

 

.rc.res:

$(BCB)\BIN\brcc32 $(RFLAGS) $<

 

#BUILD

 

$(PROJECT): $(CFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE)

    $(BCB)\BIN\$(LINKER) @&&!

    $(LFLAGS) +

    $(ALLOBJ), +

    $(PROJECT),, +

    $(ALLLIB), +

    $(DEFFILE), +

    $(ALLRES)

!

 

 

3.    Change source code for DbSetFilter()

This part can be different for other users. My start situation could be different like yours. My 16 bit applications uses already the .CDX driver from COMIX.

 

My source code contains a lot of calls to the Function CmFilter(cFilterExpression). Now I use :

1)      ADS remote server for 1 application at the moment. I am testing it with other apps

2)      ADS local server for other applications

 

I simply build an extra function like this

 

Function CmFilter(cIn)

Local bBlock := {||NIL}

If ValType(cIn) = "C".And. Len(cIn) > 0

   bBlock := &("{||"+cin+"}")

EndIf

 

If Valtype(cIn) = "C" .And. Len(cIn) > 0

   Return DbSetFilter(bBlock,cIn)

Else

   Return DbClearFilter()

EndIf

 

Now the program has also a working CmFilter() function. I did’nt have to chance anymore code to make filters working. This was not 99% but 100% suitable.

 

Maybe a user of SIX-RDD can add a working sample for this RDD.

 

4.    Using a .Bat file to compile and link

My Rad compiles and links via a call to WaitRun("n.Bat")

 

That Bat file contains

Set Path=c:\Hb\Harbour\Bin;c:\Hb\C550\Bin;c:\hb\ch

HbMake go.mak

 

5.    Convert application DLL

 

When you use Borland Resources Workshop, you make a call to a DLL. Now you have to use a RC file. Simply open your DLL with Workshop and use save as.

In My system the Dll was placed in a workdir that represents the clients situation. Now the RC file has to be in the same dir like the source code.

 

6.    Using your own LIBS

I have just added the source code of my own lib into few modules (some are in a separated PRG for the use of some statics vars) So they are also comiled in 32 bit and they anticipate unresolved externals.

 

7.    Edit the Main.Prg

Replace   hBorland := LoadLibrary("BWCC.DLL")  by  BWCCRegister(GetResources())

 

Remove the call to the DLL at the beginning of your program.

 

Copy this line at the end of the Main.Prg

Dll32 Function BWCCRegister(hInst As LONG) As WORD PASCAL LIB "BWCC32.DLL"

 

Copy this text in the settings part at the beginning of the program (After settings like SET EXACT ON/OFF)

 

RddRegister("ADS",1)

RddSetDefault("ADS")

Set Filetype To CDX

set(_SET_OPTIMIZE, .t.) // I think this is only needed for REMOTE SERVER. It gives NO error on LOCAL SERVER

 

8.    Check BWCC32.DLL

You don’t use BWCC.DLL anymore. Harbour uses the 32 bit equivalent. This has to be found in the search path. I have placed it in \WINNT\SYSTEM32\

 

9.    Using Local server and remote server together

 

You can place a ADS.INI file in the application directory. ADS 6.11 will read it when you start the application.

 

At my place the content is :

 

[SETTINGS]

ADS_SERVER_TYPE=7

 

Explanation.

1 = Local Server

2 = Remote Server

3= Internet Server.

By counting the numbers You can use them together

 

The Local server is delivered with the Clipper Client of ADS. It can be installed in the WINNT\SYSTEM32 dir.

 

The local server is a DLL ADSLOC.32.DLL. There is also the need of 2 files AdsLocal.Cfg and Extend.Chr

 

 

 

 

© 2002 Bekz.net, Inc. All Rights Reserved.