Harbour Compiler Build Questions ! UPDATED *

Re: Harbour Compiler Build Questions ! UPDATED *

Postby Antonio Linares » Thu Jun 16, 2011 1:18 am

Hua,

Please change this line:

StringFromGUID2( guid,tmpbuff,76);

hua wrote:Congrats on a successful migration Tim. I'm still waddling through.

Antonio,
when I compile the source code below I got the following error message,
guid.prg(47) : error C2664: 'StringFromGUID2' : cannot convert parameter 1 from 'GUID *' to 'const GUID &'
Reason: cannot convert from 'GUID *' to 'const GUID'
No constructor could take the source type, or constructor overload resolution was ambiguous


How can I solve this?

TIA
--
hua

Code: Select all  Expand view  RUN

//-------------------------
// GuID generieren
// Stefan Haupt, April 2005
//-------------------------
#include "FiveWin.ch"

//------------------------------------------------------------------
// standard 32 byte's M$ GuID
//------------------------------------------------------------------
FUNCTION CreateGuID32 (lNoBracket, lNoDash)

LOCAL cGuID := NewGuid()

DEFAULT lNoBracket := .t.
DEFAULT lNoDash    := .f.

IF lNoBracket
  cGuid := strtran(cGuid,"{")
  cGuid := strtran(cGuid, "}")
ENDIF
IF lNoDash
  cGuid := strtran(cGuid,"-")
ENDIF

RETURN (cGuID)



// Many thanks to Valerie for his help
// and these 2 functions

#pragma BEGINDUMP
#include <windows.h>
#include "hbapi.h"

//------------------------------------------------------------------
// standard 32 byte's M$ guid
//------------------------------------------------------------------
HB_FUNC( NEWGUID )
{
GUID guid;
char obuff[38];
memset( obuff, 0x0, 38 );
if ( CoCreateGuid(&guid) == NULL )
   {
    OLECHAR tmpbuff[76];
    StringFromGUID2(&guid,tmpbuff,76);
    WideCharToMultiByte(CP_OEMCP,0,tmpbuff,-1,obuff,38,NULL,NULL);
   }
hb_retclen(obuff,38);
}

#pragma ENDDUMP
 
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: Harbour Compiler Build Questions ! UPDATED *

Postby Antonio Linares » Thu Jun 16, 2011 1:20 am

Hua,

1. You may keep using brc32.exe with msvc 2010, there should be no problems :-)

2. Just #include <windows.h> or apply 1.

hua wrote:1. rc.exe seems to choke on
Code: Select all  Expand view  RUN
1041 bitmap loadoncall moveable discardable "j:\sw-dev\hi-res menus\tplus\bmp\1041.bmp"


Possibly due to space in the path name? Is replacing it with a short file name the only solution?

2. All my rc's were created using Borland C++ 5.02, rc spit out another error message
common.rc (8): error RC2104 : undefined keyword or key name: DS_MODALFRAME


What's the correct solution to this? Should I stop using BRW?

TIA
--
hua
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: Harbour Compiler Build Questions ! UPDATED *

Postby hua » Thu Jun 16, 2011 2:26 am

Hei, thanks for the reply Tim.

>>I see you posted a lot of questions "overnight". I know Antonio has been working on these things very late at night ( or early morning his time ), so responses may be delayed from him.

It's ok. It's just I could finally make some headway after deciding how I want to do my compilation, hence the many questions that crop up :)

>>If you have questions you can AIM chat ( MLSDG ) for a faster response, or email me directly ( "timstone@masterlinksoftware.com" ). I don't monitor the forum all day but email and IM are always live.

Thanks for the offer Tim, that's kind of you :). AIM won't be practical because of the time difference (I'm in Malaysia GMT+8). I'll be mailing you should it be necessary as I don't wanna impose on you :)

>>What tools are you using. It would appear you are implementing Harbour, but what C compiler ? I missed that.
>>I am using Visual Studio 2010, and Antonio is using the Express ( Free ) version for the linking and VC++ compiler.


I am using the Express version too. So does that mean now you create/edit all your resources using Visual Studio? What did you use before this? I was using Borland's C++
** update ** just found out Express version doesn't give you a resource editor

>>I am using the build created in UE Studio but I believe there is a make utility in the Harbour bin.

Yes there is hbmk2. But a lot of catching up and digging through Harbour's changelog and mailing list would need to be done. I much preferred a method that'd allow me to change my prg and C compiler at a whim. xMate and hbide seems to fall into that category. To an extent hbmk2 too but since I succeeded in making nmake to work I'll just stick with that for now until I have some free time in the future (somehow :)


>>RC's are a bit more interesting. The bottom line is that you can simply link in an .res file created with an rc compiler. I am using the one from VC 98 because the ones with VC 2005, VC 2008, and VC 2010 have issues with symbols and the linker. I've also successfully used the .res created with xBuilder.

As long as it produces a res file, we can link it. Ok got it.

>>I actually do most of my .rc file editing with a text editor. That may sound difficult, but once you understand how the line of code is structured, it makes it easy to line up all the controls vertically and horizontally. UE Studio allows you to edit the text and then display the result which is fine. If you are using Borlands Resource editor, get rid of the Borland specific controls / code. That gives you more flexibility. Someone posted, I believe earlier in this thread, about a free .rc compiler you can check out.

Ah, Borland controls. The thought of how much cleaning needs to be done is already filling me with dread

>>I still have some issues to resolve, but the majority of my program is now working. Yes, it is a very large, complex, program so my statement is significant !

Nice to hear that and good luck!
Last edited by hua on Thu Jun 16, 2011 3:28 am, edited 1 time in total.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Harbour Compiler Build Questions ! UPDATED *

Postby hua » Thu Jun 16, 2011 3:28 am

Antonio Linares wrote:Please change this line:

StringFromGUID2( guid,tmpbuff,76);



That solved it! Thanks Antonio :)
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Harbour Compiler Build Questions ! UPDATED *

Postby hua » Thu Jun 16, 2011 3:30 am

Antonio Linares wrote:1. You may keep using brc32.exe with msvc 2010, there should be no problems :-)
2. Just #include <windows.h> or apply 1.


That's a great tip! Thanks Antonio, I'll just keep using brc32.exe for now.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Harbour Compiler Build Questions ! UPDATED *

Postby hua » Thu Jun 16, 2011 9:19 am

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.
Last edited by hua on Fri Jun 17, 2011 9:33 am, edited 1 time in total.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Harbour Compiler Build Questions ! UPDATED *

Postby TimStone » Thu Jun 16, 2011 2:39 pm

My source code files are very large, but I did find I had been sloppy when adding some functions and making changes over the past couple of years. I have thousands of warnings mostly due to assumed variables. So this transition is also forcing me to clean up the code which is good. I'm also finding some issues where the programming was not good, so that is also being cleaned up. Yes, its a huge job, but it will lead to better results

Take a look at your .rc file and do a search on the Borland specific controls. There are not many, but you can easily replace them. I did this several years back and it was really quite easy.

I originally used Resource Workshop to develop screens, but as I said, I now do it manually. It really is easy and fast, and makes it quite easy to have uniform sizes and alignments.

Congratulations on getting your build complete.
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Harbour Compiler Build Questions ! UPDATED *

Postby hua » Sat Jun 18, 2011 9:49 pm

TimStone wrote:Congratulations on getting your build complete.


Thanks Tim. I just read something on Harbour Developr's group that kinda feels me with dread. Could you test whether an exe that's compiled with MSVC++ 2010 runs on Win98 or not? It is said that it won't run on win9x. If that's really the case I'd need to yet experiment with another compiler so at least win98 is supported. Urgh, if it's really true I don't know how to explain to my boss that I need more time to do the conversion.

I wonder what would be the next best compiler, MingW?

TIA
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Harbour Compiler Build Questions ! UPDATED *

Postby TimStone » Mon Jun 20, 2011 3:48 pm

I don't have any Win 98 machines avaiable. I saw a note but skipped over it because I could never advise my business clients to remain on that OS. It is long past its usefulness. The oldest machine my clients have are XP Pro.

It wouldn't surprise me. At some point Microsoft had to cut the ties to legacy software to move on.

Was it the 64 bit version that was not backward compatible ?

I wanted to use VC++ 2010 to have the best chance to integrate with newer .NET programs. I don't have experience with the other C compilers. There have been many discussions on relative merits.

Tim
Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
User avatar
TimStone
 
Posts: 2950
Joined: Fri Oct 07, 2005 1:45 pm
Location: Trabuco Canyon, CA USA

Re: Harbour Compiler Build Questions ! UPDATED *

Postby hua » Sat Jun 25, 2011 11:05 pm

Found a list of platforms supported by VS 2010 - http://msdn.microsoft.com/en-us/library/ms235435.aspx .

Seems Win9x and Win2000 is not supported. Some of the comments even mentioned XP requires minimum SP2 and Win Server 2003 requires minimum SP1.

But I can't confirm as there's a possibility since default libs aren't linked it'll run anyway.
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Harbour Compiler Build Questions ! UPDATED *

Postby modicr » Tue Jun 28, 2011 6:39 pm

Hello!

hua wrote:Found a list of platforms supported by VS 2010 - http://msdn.microsoft.com/en-us/library/ms235435.aspx .

Seems Win9x and Win2000 is not supported. Some of the comments even mentioned XP requires minimum SP2 and Win Server 2003 requires minimum SP1.

But I can't confirm as there's a possibility since default libs aren't linked it'll run anyway.


http://tedwvc.wordpress.com/2010/11/07/ ... dows-2000/

Regards, Roman
© I'm not patented!
User avatar
modicr
 
Posts: 207
Joined: Fri Oct 07, 2005 7:58 am
Location: ljubljana, barje, slovenia

Re: Harbour Compiler Build Questions ! UPDATED *

Postby hua » Wed Jun 29, 2011 2:37 am

Thanks for sharing the info Roman. I am also considering KernelEx
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Re: Harbour Compiler Build Questions ! UPDATED *

Postby hua » Mon Jul 04, 2011 8:33 am

In Harbour, which lib contains dbzap()? I want to avoid renaming it to hb_dbzap() so my source can be compiled by both xHarbour and Harbour.

TIA
hua
 
Posts: 1072
Joined: Fri Oct 28, 2005 2:27 am

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 41 guests