FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Unresolved external symbol '__chkstk (solved)
Posts: 392
Joined: Tue Mar 10, 2009 11:54 AM
Unresolved external symbol '__chkstk (solved)
Posted: Sat Mar 16, 2013 11:15 AM

I have this link error:

xLINK: error: Unresolved external symbol '__chkstk referenced from FiveHCM.lib(C5CNEW.obj)'

and doesn't know how to solve it.

Windows 11 Pro 22H2 22621.1848

Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384

Harbour 3.2.0dev (r2008190002)

FWH 23.10 x86
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Unresolved external symbol '__chkstk
Posted: Sat Mar 16, 2013 11:52 AM

Frank,

If I open FWH 13.02 FiveHCM.lib with a binary editor (I use "view" from Total Commander) and search for "chkstk" it is not found.

Could you please do the same on your FiveHCM.lib and check if there is any occurrence of "chkstk" inside it ? thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 392
Joined: Tue Mar 10, 2009 11:54 AM
Re: Unresolved external symbol '__chkstk
Posted: Sat Mar 16, 2013 04:35 PM

Antonio,

ok, I switched temporarily to FWH 1205 and got the

Unresolved external symbol '__chkstk referenced from FiveHCM.lib(C5CNEW.obj)'

With FWH 1302 the link error

Unresolved external symbol '__chkstk referenced from FiveHMX.lib(SCINTILA.obj)'

comes up ;-(

Windows 11 Pro 22H2 22621.1848

Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384

Harbour 3.2.0dev (r2008190002)

FWH 23.10 x86
Posts: 729
Joined: Tue Oct 18, 2005 06:49 PM
Re: Unresolved external symbol '__chkstk
Posted: Sun Mar 17, 2013 04:26 AM
Antonio,
Using January 2013 xHarbour Builder and FWH 13.02 these are the messages displayed when I try to create the ALERT.EXE sample:
Code (fw): Select all Collapse
Type: C >>>xhb.exe -o"alert.c" -m -n -p -q -gc0   -I"C:\fwh13_02\include" -I"C:\xHBJan13\include" -I"C:\xHBJan13\include\w32" "C:\FWH13_02\SAMPLES\alert.prg"<<<

xHarbour Compiler build 1.2.2 (SimpLex) (Rev. 9719)
Copyright 1999-2012, http://www.xharbour.org <!-- m --><a class="postlink" href="http://www.harbour-project.org/">http://www.harbour-project.org/</a><!-- m -->
Generating object output to 'alert.obj'...

Type: C >>>xlink.exe -NOEXPOBJ -MAP -FORCE:MULTIPLE -NOIMPLIB -subsystem:windows -UNMANGLE -LIBPATH:"C:\fwh13_02\lib" -LIBPATH:"C:\xHBJan13\lib" -LIBPATH:"C:\xHBJan13\c_lib" -LIBPATH:"C:\xHBJan13\c_lib\win"  "alert.obj" "FiveHCM.lib" "FiveHMX.lib" "OptG.lib" "xhb.lib" "dbf.lib" "nsx.lib" "ntx.lib" "cdx.lib" "rmdbfcdx.lib" "ct3comm.lib" crt.lib kernel32.lib user32.lib winspool.lib ole32.lib oleaut32.lib odbc32.lib odbccp32.lib uuid.lib wsock32.lib ws2_32.lib wininet.lib advapi32.lib shlwapi.lib msimg32.lib mpr.lib OleDlg.lib version.lib comctl32.lib comdlg32.lib gdi32.lib shell32.lib winmm.lib lz32.lib Netapi32.lib -out:"C:\FWH13_02\SAMPLES\ALERT.EXE"<<<

xLINK: warning: Symbol 'C:\xHBJan13\lib\xhb.lib(dllcall.obj)->_HB_FUN_GETPROCADDRESS previously defined at C:\fwh13_02\lib\FiveHCM.lib(GETPROCA.obj)' is multiply defined.
xLINK: warning: Symbol 'C:\fwh13_02\lib\FiveHCM.lib(WINEXEC.obj)->_HB_FUN_GETLASTERROR previously defined at C:\xHBJan13\lib\xhb.lib(dllcall.obj)' is multiply defined.
Creating object: C:\FWH13_02\SAMPLES\ALERT.EXP
Creating library: C:\FWH13_02\SAMPLES\ALERT.LIB
xLINK: error: Unresolved external symbol '_GlobalMemoryStatusEx referenced from FiveHCM.lib(MEM.obj)'.
xLINK: error: Unresolved external symbol '_SendInput referenced from FiveHCM.lib(KEYBRD.obj)'.
xLINK: fatal error: 2 unresolved external(s).

Type: C >>>Couldn't build: ALERT.EXE<<<
Type: C >>>TMAKEPROJECT<<<
Type: C >>>TMAKEPROJECT:REFRESH<<<
Type: N >>>      1405<<<

The solution that I am using, found in this forum, is by adding the following libraries: MEM32.LIB and SEND32.LIB

To fix the __chkstk error found also in FWH 13.02 (xLINK: error: Unresolved external symbol '__chkstk referenced from FiveHMX.lib(SCINTILA.obj)'.), I am using:

Code (fw): Select all Collapse
  #pragma BEGINDUMP

   #include <windows.h>

   void _chkstk( void )
   {
   MessageBox( 0, "inside chkstk()", "ok", 0 );
    }

   #pragma ENDDUMP

Regards,

George
Posts: 518
Joined: Fri Jun 29, 2012 12:49 PM
Re: Unresolved external symbol '__chkstk
Posted: Sun Mar 17, 2013 10:05 AM

George,

I recommend you to change to Harbour.

You will quit having those issues with xHarbour.com and their lack of support. Timm, for example, moved to Harbour and he is very happy and proud of that change.

Posts: 392
Joined: Tue Mar 10, 2009 11:54 AM
Re: Unresolved external symbol '__chkstk
Posted: Sun Mar 17, 2013 10:07 AM

Antonio, George,

with the c-function 'void _chkstk' it's linking again without error :D

Thank you very much

Windows 11 Pro 22H2 22621.1848

Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384

Harbour 3.2.0dev (r2008190002)

FWH 23.10 x86
Posts: 392
Joined: Tue Mar 10, 2009 11:54 AM
Re: Unresolved external symbol '__chkstk (solved)
Posted: Sun Mar 17, 2013 10:39 AM
Elvira,

tried to switch to Harbour very hard, but there are some drawbacks, like

- Using RMDBFCDX for local users, it's very fast, I don't want to miss it
- AFAIK there is no comparable replacement for Visual xDebugger
- I'm using some function only available in xHarbour, e.g.
Code (fw): Select all Collapse
DbUseArea( [<lNewArea>]  , ;
           [<cRddName>]  , ;
           <cDatabase>   , ;
           [<cAlias>]    , ;
           [<lShared>]   , ;
           [<lReadonly>] , ;
           [<cCodePage>] , ;
           [<nConnection>] ) --> NIL

I'm using the parameter [<nConnection>] to communicate with different ADS simultaneously

So until now, I'm still working with xHarbour and put my migration project on ice :-)
Windows 11 Pro 22H2 22621.1848

Microsoft (R) Windows (R) Resource Compiler Version 10.0.10011.16384

Harbour 3.2.0dev (r2008190002)

FWH 23.10 x86
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Unresolved external symbol '__chkstk (solved)
Posted: Sun Mar 17, 2013 02:59 PM
Frank,

This enhancement on Class TScintilla solves the call to __chkstk() when using MSVC compiler:

FWH/source/classes/scintila.prg
Code (fw): Select all Collapse
#define BUFSIZE 131072

HB_FUNC( SCI_OPENFILE )
{
   HWND hWnd = ( HWND ) hb_parnl( 1 );
   char * fileName = ( char * ) hb_parc( 2 );
   char * data;
   FILE * fp;
   int lenFile;

   data = hb_xgrab( BUFSIZE );

   // SendMessage( hWnd, SCI_CLEARALL, 0, 0 );
   SendMessage( hWnd, EM_EMPTYUNDOBUFFER, 0, 0 );
   SendMessage( hWnd, SCI_SETSAVEPOINT, 0, 0 );
   SendMessage( hWnd, SCI_CANCEL, 0, 0 );
   SendMessage( hWnd, SCI_SETUNDOCOLLECTION, 0, 0 );

   fp = fopen( fileName, "rb" );
   
   if( fp ) 
   {
      lenFile = fread( data, 1, BUFSIZE, fp );
   
      while( lenFile > 0 ) 
      {
         SendMessage( hWnd, SCI_ADDTEXT, lenFile, ( LPARAM ) data );
         lenFile = fread( data, 1, BUFSIZE, fp );
      }
      
      fclose( fp );
   } 
   else 
   {
      MessageBox( 0, "Can't open the file", "Attention", MB_OK );
   }
   
   SendMessage( hWnd, SCI_SETUNDOCOLLECTION, 1, 0 );
   SetFocus( hWnd );
   SendMessage( hWnd, EM_EMPTYUNDOBUFFER, 0, 0 );
   SendMessage( hWnd, SCI_SETSAVEPOINT, 0, 0 );
   SendMessage( hWnd, SCI_GOTOPOS, 0, 0 );
   
   hb_xfree( data );
   
   hb_ret();
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Unresolved external symbol '__chkstk (solved)
Posted: Sun Mar 17, 2013 03:08 PM
Frank,

The problem with these two warnings is only for xHarbour, with Harbour is fine as Harbour does not implement these functions:

xLINK: warning: Symbol 'C:\xHBJan13\lib\xhb.lib(dllcall.obj)->_HB_FUN_GETPROCADDRESS previously defined at C:\fwh13_02\lib\FiveHCM.lib(GETPROCA.obj)' is multiply defined.
xLINK: warning: Symbol 'C:\fwh13_02\lib\FiveHCM.lib(WINEXEC.obj)->_HB_FUN_GETLASTERROR previously defined at C:\xHBJan13\lib\xhb.lib(dllcall.obj)' is multiply defined.
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Unresolved external symbol '__chkstk (solved)
Posted: Sun Mar 17, 2013 03:15 PM

Frank,

We have solved it moving FWH functions GetProcAddress() and GetLastError() to harbour.prg, so they don't get included for xHarbour :-)

It will be available in next FWH build.

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Unresolved external symbol '__chkstk (solved)
Posted: Sun Mar 17, 2013 03:22 PM
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Unresolved external symbol '__chkstk (solved)
Posted: Sun Mar 17, 2013 03:34 PM
Frank,

AFAIK there is no comparable replacement for Visual xDebugger


Have you used the FWH built in debugger ? To use it simply use the /b flag to compile your PRGs. In example:

buildh.bat tutor02 /b

What missing features do you find comparing it with Visual xDebugger ? thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Unresolved external symbol '__chkstk (solved)
Posted: Sun Mar 17, 2013 03:39 PM
Frank,

It seems to me as Harbour also provide the same funcionality on DbUseArea(), see this from Harbour:

As you see, nConnection parameter is there also.

Code (fw): Select all Collapse
/* dbUseArea( [<lNewArea>], [<cDriver>], <cName>, [<xcAlias>], [<lShared>], [<lReadonly>], [<cCodePage>], [<nConnection>] ) -> NIL */

HB_FUNC( DBUSEAREA )
{
   hb_retl( hb_rddOpenTable( hb_parc( 3 ), hb_parc( 2 ),
         hb_parl( 1 ) ? 0 : ( HB_AREANO ) hb_rddGetCurrentWorkAreaNumber(),
         hb_parc( 4 ), HB_ISLOG( 5 ) ? hb_parl( 5 ) : !hb_setGetExclusive(),
         hb_parl( 6 ), hb_parc( 7 ), hb_parnl( 8 ), NULL, NULL ) == HB_SUCCESS );
}
regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 729
Joined: Tue Oct 18, 2005 06:49 PM
Re: Unresolved external symbol '__chkstk (solved)
Posted: Sun Mar 17, 2013 04:37 PM

Antonio,
For some time I have been considering changing from [x] Harbour to harbour.
However, due to the ease of integrating different type of files and the fact that I do not have to use any *.mak file, I have decided to continue using [x] Harbour.
What other(s) software do you recommend that I could use with Harbour in order to substitute xBuilder?
What other advantages would have the use of Harbour?

Regards,

George

Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Unresolved external symbol '__chkstk (solved)
Posted: Sun Mar 17, 2013 10:27 PM
George,

The differences are explained in Harbour/doc/xhb-diff.txt

I have uploaded it to:
https://code.google.com/p/harbour-and-xharbour-builds/downloads/detail?name=xhb-diff.txt

Regarding the make utility, Harbour provides a hbmk2.exe utility that automatizes the creation of an EXE, but it is to be run from a console, so here I have started building a Visual interface for hbmk2.exe:

vhb.prg
Code (fw): Select all Collapse
#include "FiveWin.ch"

//----------------------------------------------------------------------------//

function BuildWindow()

   local oDlg, oGet1, cPrgName := Space( 20 ), oSay3, oFld1, oSay2, oBtn1, oBtn2
   local cResult, oResult, cPath, nRetCode

   SetDlgGradient( { { 1, RGB( 199, 216, 237 ), RGB( 237, 242, 248 ) } } )
   
   DEFINE DIALOG oDlg TITLE "Visual make for Harbour" ;
      SIZE 600, 500

   @ 16,  16 SAY oSay2 PROMPT "Main PRG" SIZE  30, 9 PIXEL OF oDlg

   @ 25, 16 GET oGet1 VAR cPrgName SIZE 120, 12 PIXEL OF oDlg ;
      ACTION oGet1:VarPut( cGetFile( "*.prg" ) )

   @ 50,  16 SAY oSay3 PROMPT "Additional" SIZE 30, 9 PIXEL OF oDlg

   @ 60, 16 FOLDER oFld1 PROMPTS "PRGs", "OBJs", "LIBs" ;
      SIZE 200, 100 PIXEL OF oDlg

   @ 22, 230 BUTTON oBtn1 PROMPT "&Build" ;
      SIZE 60, 20 PIXEL OF oDlg ;
      ACTION ( MemoWrit( "go.bat", "set path=c:\bcc582\bin" + CRLF + ;
                                   "c:\harbour\bin\hbmk2 " + ;
                                   "-comp=bcc " + ;
                                   "-ic:\fwh\include " + ;
                                   "-lfiveh.lib " + ;
                                   "-lfivehc.lib " + ;
                                   "-Lc:\fwh\lib " + ;
                                   "-lc:\bcc582\lib\psdk\psapi.lib " + ;
                                   "xhb.hbc " + ;
                                   "-gtgui " + ;
                                   AllTrim( cPrgName ) ),;
               nRetCode := WaitRun( "go.bat > out.log", 0 ),;
               oResult:SetText( GetError( nRetCode ) + CRLF + MemoRead( "out.log" ) ),;
               WaitRun( cFileNoExt( cPrgName ) ),;
               hb_SetEnv( "path", cPath ) )

   @ 48, 230 BUTTON oBtn2 PROMPT "&Cancel" ;
      SIZE 60, 20 PIXEL OF oDlg ;
      ACTION oDlg:End()

   @ 170, 16 SAY oSay3 PROMPT "Result" SIZE 30, 9 PIXEL OF oDlg

   @ 180, 16 GET oResult VAR cResult MEMO ;
      SIZE 200, 60 PIXEL OF oDlg

   ACTIVATE DIALOG oDlg CENTERED

return oDlg

//----------------------------------------------------------------------------//

function GetError( nError )

   do case
      case nError == 0
           return "Ok"
   
      case nError == 2
           return "unknown compiler"
           
      case nError == 6
           return "failed in compilation (Harbour, C compiler, Resource compiler)"
         
      case nError == 7
           return "failed in final assembly (linker or library manager)"         
         
   endcase
   
return Str( nError )

//----------------------------------------------------------------------------//
regards, saludos

Antonio Linares
www.fivetechsoft.com