I've succeeded in compiling my source. Here's the general steps that I took:
i. Follow the instruction
here to download both MS Visual Studio 2010 Express and Harbour's source.
ii. I normally do my work via
Far Manager. So I change my batch file that starts it by inserting in the first line
- Code: Select all Expand view RUN
call "%ProgramFiles%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
to set up the necessary environment variables.
iii. As I used a lot of xharbour extended syntax and commands and I want to minimize changes to my source, I need to link in xhb.lib with its .ch files. I copied harbour's xhb.ch and hbcompat.ch into harbour\include.
iv. Ammended fivewin.ch to include xhb.ch
- Code: Select all Expand view RUN
#ifdef __HARBOUR__
#ifdef __XHARBOUR__
#ifndef __64__
#define FWVERSION "FWHX 10.5"
#define FWDESCRIPTION "FiveWin for xHarbour"
#else
#define FWVERSION "FWHX64 10.5"
#define FWDESCRIPTION "FiveWin for xHarbour 64"
#endif
#else
#include "xhb.ch"
#ifndef __64__
#define FWVERSION "FWH 10.5"
#define FWDESCRIPTION "FiveWin for Harbour"
#else
#define FWVERSION "FWH64 10.5"
#define FWDESCRIPTION "FiveWin for Harbour 64"
#endif
#endif
#xtranslate Browse( => WBrowse( // to avoid conflicts with Harbour functions
#xtranslate SetCursor( => WSetCursor( // to avoid conflicts with Harbour functions
#xtranslate __Keyboard( => ___Keyboard( // to avoid conflicts with Harbour functions
#xtranslate LastKey( => _LastKey( // to avoid conflicts with Harbour functions
#else
#ifdef __XPP__
#define FWVERSION "FiveWin++ 10.5"
#define FWDESCRIPTION "FiveWin++ for Xbase++"
#else
#define __CLIPPER__
#define FWVERSION "FiveWin 10.5"
#define FWDESCRIPTION "FiveWin for Clipper"
#endif
#endif
v. Some part of my code uses xHarbour's new command HAS. It need to be enclosed in parentheses to allow xhb.ch to do the translation correctly. e.g.
- Code: Select all Expand view RUN
lRet := cDesc HAS "\bCREDITOR: " .or. cDesc HAS "\bDEBTOR: "
becomes
- Code: Select all Expand view RUN
lRet := (cDesc HAS "\bCREDITOR: ") .or. (cDesc HAS "\bDEBTOR: ")
vi. Changed IsDir() to IsDirectory() as Harbour don't have IsDir()
vii. Instead of using Microsoft's rc.exe, I stick with Borland's brc32.exe instead
viii. Dumped rmake and use nmake instead. Sample:
- Code: Select all Expand view RUN
rem link.bat
@echo off
cls
if "%1"=="" goto NoDefine
call nmake -fjnl.mak SWITCH=/d%1
goto common
:NoDefine
nmake -fjnl.mak
:common
if not errorlevel 1 goto compress
goto ErrorFound
:compress
upx journal.exe
goto end
:ErrorFound
echo OMG! OMG! ...
:end
- Code: Select all Expand view RUN
#Microsoft make sample, (c) FiveTech Software 2005
HBDIR=j:\harbour\hb21
VCDIR="c:\Program Files\Microsoft Visual Studio 10.0\VC"
FWDIR=j:\harbour\fwh
.SUFFIXES: .prg .c .obj .rc .res
journal.exe : journal.obj proc.obj journal.res
echo journal.obj proc.obj > msvc.tmp
echo $(FWDIR)\lib\FiveHM.lib $(FWDIR)\lib\FiveHCM.lib >> msvc.tmp
echo $(HBDIR)\lib\xhb.lib >> msvc.tmp
echo $(HBDIR)\lib\hbrtl.lib >> msvc.tmp
echo $(HBDIR)\lib\hbvm.lib >> msvc.tmp
echo $(HBDIR)\lib\gtgui.lib >> msvc.tmp
echo $(HBDIR)\lib\hblang.lib >> msvc.tmp
echo $(HBDIR)\lib\hbmacro.lib >> msvc.tmp
echo $(HBDIR)\lib\hbrdd.lib >> msvc.tmp
echo $(HBDIR)\lib\rddntx.lib >> msvc.tmp
echo $(HBDIR)\lib\rddcdx.lib >> msvc.tmp
echo $(HBDIR)\lib\rddfpt.lib >> msvc.tmp
echo $(HBDIR)\lib\hbsix.lib >> msvc.tmp
echo $(HBDIR)\lib\hbdebug.lib >> msvc.tmp
echo $(HBDIR)\lib\hbcommon.lib >> msvc.tmp
echo $(HBDIR)\lib\hbpp.lib >> msvc.tmp
echo $(HBDIR)\lib\hbcpage.lib >> msvc.tmp
echo $(HBDIR)\lib\hbwin.lib >> msvc.tmp
echo $(HBDIR)\lib\hbpcre.lib >> msvc.tmp
echo $(HBDIR)\lib\hbct.lib >> msvc.tmp
echo $(HBDIR)\lib\hbnf.lib >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\Kernel32.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\User32.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\Gdi32.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\WinSpool.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\ComCtl32.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\ComDlg32.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\AdvAPI32.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\shell32.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\Ole32.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\OleAut32.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\Uuid.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\odbc32.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\odbccp32.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\IPHlpApi.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\Mpr.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\Version.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\WSock32.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\MSImg32.lib" >> msvc.tmp
echo "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Lib\OleDlg.lib" >> msvc.tmp
IF EXIST journal.res echo journal.res >> msvc.tmp
SET LIB=$(VCDIR)\lib
link.exe @msvc.tmp /nologo /subsystem:windows /force:multiple /NODEFAULTLIB:libc > link.log
@type link.log
journal.obj : journal.c
proc.obj : proc.c
journal.c : journal.prg
proc.c : proc.prg
# still using borland's resource compiler here
journal.res : journal.rc
j:\harbour\bcc55\bin\brc32 -r journal.rc
.prg.c:
$(HBDIR)\bin\harbour $< $(SWITCH) /n /i$(FWDIR)\include;$(HBDIR)\include
.c.obj:
$(VCDIR)\bin\cl -c -TP -W3 -GA -I$(HBDIR)\include -I$(VCDIR)\include $<
That's all. Now to test my exe to ascertain it's working as it should. Thank you.