Unresolved external symbol '__chkstk (solved)

Unresolved external symbol '__chkstk (solved)

Postby frose » 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.
Last edited by frose on Sun Mar 17, 2013 10:07 am, edited 1 time in total.
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
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: Unresolved external symbol '__chkstk

Postby Antonio Linares » 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41331
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Unresolved external symbol '__chkstk

Postby frose » Sat Mar 16, 2013 4: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
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: Unresolved external symbol '__chkstk

Postby George » Sun Mar 17, 2013 4: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: Select all  Expand view

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 http://www.harbour-project.org/
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: Select all  Expand view
  #pragma BEGINDUMP

   #include <windows.h>

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

   #pragma ENDDUMP
 

Regards,

George
George
 
Posts: 724
Joined: Tue Oct 18, 2005 6:49 pm

Re: Unresolved external symbol '__chkstk

Postby elvira » 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.
elvira
 
Posts: 515
Joined: Fri Jun 29, 2012 12:49 pm

Re: Unresolved external symbol '__chkstk

Postby frose » 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
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: Unresolved external symbol '__chkstk (solved)

Postby frose » 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: Select all  Expand view
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 :cry:
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
User avatar
frose
 
Posts: 392
Joined: Tue Mar 10, 2009 11:54 am
Location: Germany, Rietberg

Re: Unresolved external symbol '__chkstk (solved)

Postby Antonio Linares » Sun Mar 17, 2013 2:59 pm

Frank,

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

FWH/source/classes/scintila.prg
Code: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 41331
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Unresolved external symbol '__chkstk (solved)

Postby Antonio Linares » Sun Mar 17, 2013 3: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41331
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Unresolved external symbol '__chkstk (solved)

Postby Antonio Linares » Sun Mar 17, 2013 3: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41331
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Unresolved external symbol '__chkstk (solved)

Postby Antonio Linares » Sun Mar 17, 2013 3:22 pm

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41331
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Unresolved external symbol '__chkstk (solved)

Postby Antonio Linares » Sun Mar 17, 2013 3: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
User avatar
Antonio Linares
Site Admin
 
Posts: 41331
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Unresolved external symbol '__chkstk (solved)

Postby Antonio Linares » Sun Mar 17, 2013 3: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: Select all  Expand view
/* 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
User avatar
Antonio Linares
Site Admin
 
Posts: 41331
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Unresolved external symbol '__chkstk (solved)

Postby George » Sun Mar 17, 2013 4: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
George
 
Posts: 724
Joined: Tue Oct 18, 2005 6:49 pm

Re: Unresolved external symbol '__chkstk (solved)

Postby Antonio Linares » 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: Select all  Expand view
#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
User avatar
Antonio Linares
Site Admin
 
Posts: 41331
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 17 guests