Page 1 of 2

hbmk2 problem

PostPosted: Mon Jul 10, 2023 5:29 pm
by TimStone
Over the past couple of years, there has been encouragement to use Harbor's hbmk2 to build applications.

My application is large, and with Antonio's guidance, I have attempted to build it using hbmk2

PLEASE NOTE: The program builds without error using a .mak file, and also building with Visual Studio Community 2023 directly. So this is NOT a coding error.

I have done a series of eliminations, and extensive testing, and the following is the result:


Code: Select all  Expand view
oARhistory:seek( dBegDate, .t. )


oARhistory is a database object

The error returned is: marutilities.prg(106) Error E0030 Syntax error "syntax error at '('"

The failure is that hbmk2 does not recognize more than the first parameter in the Seek() method. It will compile correctly if I comment out the 2nd parameter. In the database class, seek is defined as:

Code: Select all  Expand view
  METHOD Seek( uExp, lSoft, lWildSeek, lCurRec )


In this case, I am passing a value of TRUE for lSoft ( soft seek ).

This would suggest that hbmk2 is actually not processing the database class in FWH but using something native to Harbour itself.

Has anyone else experienced this ? If so, have you found a workaround ? If you are using hbmk2 perhaps you have some further guidance. Thank you.

( I know it is very popular to ask for a working sample. However, I believe the issue here is very specific and enough detail has been provided. It would be a challenge to try and write a small subset of code )

Re: hbmk2 problem

PostPosted: Mon Jul 10, 2023 5:48 pm
by Antonio Linares
Dear Tim,

I just coded this little PRG and hbmk2 properly builds it so I tend to think that there is a preprocessor issue. Please compile it using -p to generate a PPO file and please check if such line gets modified, maybe a define is changing the code, many thanks:

This code generates an obvious runtime error but not a compiling error. The compiler does not check classes, etc. It just check the syntax.

tim.prg
Code: Select all  Expand view
#include "FiveWin.ch"

function Main()

    local o, dToday := Date()

    o:seek( dToday, .T. )

return nil


tim.hbp
Code: Select all  Expand view
-gui

tim.prg

-Ic:\fwh\include

-Lc:\fwh\lib
-lfiveh32
-lfivehc32

-lgdiplus
-lole32
-lOleDlg
-lversion

xhb.hbc
hbmzip.hbc
hbziparc.hbc

-ldflag=/NODEFAULTLIB:msvcrt


and this go.bat to build it:
Code: Select all  Expand view
setlocal
call "%ProgramFiles%\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" x86
c:\harbour\bin\win\msvc\hbmk2 tim.hbp
endlocal

Re: hbmk2 problem

PostPosted: Mon Jul 10, 2023 6:39 pm
by TimStone
I am seeing this:

        oARhistory := TARhistory():New( 2 )

       oARhistory:(.T.)->( dbSeek( dBegDate ) )

        while ! oARhistory:eof( )

Re: hbmk2 problem

PostPosted: Mon Jul 10, 2023 9:13 pm
by Antonio Linares
Dear Tim,

What header files .CH are you using from such PRG ?

Re: hbmk2 problem

PostPosted: Mon Jul 10, 2023 9:35 pm
by TimStone
For that .prg, just fivewin.ch and tdata.ch. I commented out the the tdata, though that has no reference to seek(), and it made no difference. So essentially, just fivewin

Re: hbmk2 problem

PostPosted: Mon Jul 10, 2023 9:53 pm
by Antonio Linares
Dear Tim,

It seems as

oARhistory:seek( dBegDate, .t. )

is preprocessed into:

oARhistory:(.T.)->( dbSeek( dBegDate ) )

Please search in all your used CH files and look for dbSeek

Re: hbmk2 problem

PostPosted: Mon Jul 10, 2023 9:56 pm
by Antonio Linares
Also, please comment this line in fwstd.ch

// #command SEEK <xpr> => dbSeek( <xpr> )

just in case the error comes from here

Re: hbmk2 problem

PostPosted: Mon Jul 10, 2023 10:14 pm
by TimStone
I made the change you suggested and have the same error.

I did a search of ALL .ch files in FWH, Harbour, and my program. I looked for instances of SEEK and DBSEEK
There were no re-defines in any of those

It is strange that clearly, as shown by the PPO, that :seek is being redefined, but just how seems to be avoiding us.

Re: hbmk2 problem

PostPosted: Tue Jul 11, 2023 6:28 am
by Antonio Linares
Dear Tim,

Please build my above example and lets see what you get

thank you

Re: hbmk2 problem

PostPosted: Wed Jul 12, 2023 7:24 pm
by TimStone
Antonio,

Yesterday was our 53rd wedding anniversary, so I took off most of the day.

I did the build this morning, and it comes up as it did with you.

I also defined o as a tdatabase():new( ) and it still shows, in the PPO, that the seek in correct.

So now I will need to continue searching for an include file that might redefine the seek.

Tim

Re: hbmk2 problem

PostPosted: Wed Jul 12, 2023 10:47 pm
by TimStone
Antonio,

In your example, the code:o:seek( dToday, .T. ) becomes:o:seek( dToday, .T. ) in the PPO

In my application, oARhistory:seek( dBegDate, .t. ). becomes: oARhistory:(.T.)->( dbSeek( dBegDate ) )

Clearly a #translate is active here. I have looked at:
+ All source code I have written
+ All FWH source in classes, functions, and winapi
+ All FWH\include files
+ All Harbour\include files
+ Any project include files

I can't find a seek( ) modification anywhere.

Do you have any other ideas on where to look ?

Tim

Re: hbmk2 problem

PostPosted: Thu Jul 13, 2023 4:40 am
by Antonio Linares
Dear Tim,

Do you use any #define on that PRG ?

Re: hbmk2 problem

PostPosted: Thu Jul 13, 2023 5:39 am
by TimStone
There are no #define in that .prg

There are some elsewhere in the total application, but none of them show anything related to databases.

Re: hbmk2 problem

PostPosted: Thu Jul 13, 2023 8:44 am
by Antonio Linares
Dear Tim,

Then I would suggest to completely remove all the files in FWH\include and reinstall them

If that does not solve it, then you should do the same with harbour\include folder

Re: hbmk2 problem

PostPosted: Thu Jul 13, 2023 10:07 pm
by TimStone
The easiest way to do that is to install the latest downloads from the FW subscription site.

That was no problem for FWH. However, the latest posted MVSC Harbour build is 3 years old, and it does not show a download.

Do you have a link to download the latest Harbour installation file ? Maybe there is a problem with the older version.

Tim