Hello.
I have a problem trying to compile the testtool.prg
I'm receiving some errors from the xharbor.com compiler inside the c source.
Someone knows how can I make ?
Thanks a lot.
Massimo
// Testing Windows ToolHelp.dll
#include "FiveWin.ch"
//----------------------------------------------------------------------------//
function Main()
local aTimerInfo := TimerCount()
// Determining how long an application has been running
MsgInfo( "Milliseconds since this task started: " + Str( aTimerInfo[ 1 ] ) )
MsgInfo( "Milliseconds since the VM started:" + Str( aTimerInfo[ 2 ] ) )
// Controlling possible GPFs !!!
InterruptRegister( { || ControlGPF() } ) // Setting our own GPF controller
// Comment the above function and see the difference !
__GenGPF() // Now we generate a GPF !!!
return nil
//----------------------------------------------------------------------------//
function ControlGPF()
MsgAlert( "A GPF has occurred" + CRLF + "I am URGENTLY closing everything!" )
// CLOSE ALL --> Here we close all our files !!!
MsgInfo( "We recommend reboot the computer, or at least exit Windows" )
InterruptUnRegister() // We release our GPF controller
Eval( ErrorBlock(), _FWGenError( 5, "Undetermined GPF" ) )
// you can use the FiveWin
// Error SubSystem !!!
return nil
//----------------------------------------------------------------------------//
// Suport for Windows ToolHelp.dll
#include <c:\fwh\include\WinTen.h>
#include <Windows.h>
#include <c:\fwh\include\ClipApi.h>
#ifndef __FLAT__
#include <c:\fwh\include\ToolHelp.h>
#define PCLIPVAR void *
#endif
extern HINSTANCE GetInstance( void );
static void far PASCAL _export IntCallBack( void );
static far FARPROC lpfnCallBack = 0;
#ifndef __FLAT__
static far PCLIPVAR bInterruptAction = 0;
#endif
//----------------------------------------------------------------------------//
CLIPPER INTERRUPTR( PARAMS ) // EGISTER( bAction ) --> lSuccess
{
#ifndef __FLAT__
if( lpfnCallBack )
{
FreeProcInstance( lpfnCallBack );
lpfnCallBack = 0;
}
if( bInterruptAction )
{
_DropGrip( bInterruptAction );
bInterruptAction = 0;
}
lpfnCallBack = MakeProcInstance( ( FARPROC ) IntCallBack, GetInstance() );
bInterruptAction = _GetGrip( _param( 1, -1 ) );
_retl( InterruptRegister( 0, lpfnCallBack ) );
#endif
}
//----------------------------------------------------------------------------//
CLIPPER INTERRUPTU( PARAMS ) // NREGISTER() --> lSuccess
{
#ifndef __FLAT__
BOOL bResult = InterruptUnRegister( GetInstance() );
if( bResult )
{
if( lpfnCallBack )
{
FreeProcInstance( lpfnCallBack );
lpfnCallBack = 0;
}
if( bInterruptAction )
{
_DropGrip( bInterruptAction );
bInterruptAction = 0;
}
}
_retl( bResult );
#endif
}
//----------------------------------------------------------------------------//
CLIPPER TIMERCOUNT( PARAMS ) // --> { nMsSinceStart, nMsThisVM }
{
#ifndef __FLAT__
TIMERINFO ti;
ti.dwSize = sizeof( TIMERINFO );
if( TimerCount( &ti ) )
{
_reta( 2 );
_stornl( ti.dwmsSinceStart, -1, 1 );
_stornl( ti.dwmsThisVM, -1, 2 );
}
else
_ret();
#endif
}
//----------------------------------------------------------------------------//
static void far PASCAL _export IntCallBack( void )
{
#ifndef __FLAT__
if( bInterruptAction )
_cEval0( bInterruptAction );
#endif
}
//----------------------------------------------------------------------------//
CLIPPER TERMINATEA( PARAMS ) // PP( hTask, nMode ) --> nil
{
#ifndef __FLAT__
TerminateApp( _parni( 1 ), IF( PCOUNT() > 1, _parni( 2 ), NO_UAE_BOX ) );
#else
TerminateProcess( ( HANDLE ) _parnl( 1 ),
IF( PCOUNT() > 1, _parni( 2 ), 0 ) );
#endif
}
//----------------------------------------------------------------------------//
These are the errors
Type: C >>>xcc.exe -Fo"c\toolhelp.obj" -Ot -I"C:\xHB\include" -I"C:\xHB\c_include" -I"C:\xHB\c_include\win" -I"C:\xHB\c_include\msvc" "toolhelp.c"<<<
c:\fwh\include\ClipApi.h(71): error: Expecting an enumerator identifier.
c:\fwh\include\ClipApi.h(71): error: Syntax error; found '0' expecting '}'.
c:\fwh\include\ClipApi.h(463): error: Redeclaration of 'strlen' previously declared at C:\xHB\c_include\string.h(30): found 'unsigned short __cdecl function(char *)' expected 'unsigned int __cdecl function(const char *)'.
c:\fwh\include\ClipApi.h(464): error: Redeclaration of 'strcpy' previously declared at C:\xHB\c_include\string.h(27): found 'void __cdecl function(unsigned char *, unsigned char *)' expected 'char * __cdecl function(restrict char *, restrict const char *)'.
c:\fwh\include\ClipApi.h(465): error: Redeclaration of 'strcmp' previously declared at C:\xHB\c_include\string.h(25): found 'int __cdecl function(char *, char *)' expected 'int __cdecl function(const char *, const char *)'.
c:\fwh\include\ClipApi.h(466): error: Redeclaration of 'strcat' previously declared at C:\xHB\c_include\string.h(23): found 'unsigned char * __cdecl function(unsigned char *, unsigned char *)' expected 'char * __cdecl function(restrict char *, restrict const char *)'.
c:\fwh\include\ClipApi.h(511): warning: Missing type specifier.
toolhelp.c(14): warning: Illegal use of '__stdcall'.
toolhelp.c(14): error: Undefined size for '_export' with type 'void'.
toolhelp.c(14): error: Syntax error; found 'IntCallBack' expecting ';'.
toolhelp.c(14): warning: Missing type specifier.
toolhelp.c(41): warning: Overflow in converting constant expression from 'unsigned int' to 'unsigned short'.
toolhelp.c(43): warning: Missing prototype for 'InterruptRegister'.
toolhelp.c(52): warning: Missing prototype for 'InterruptUnRegister'.
toolhelp.c(77): error: Undeclared identifier 'TIMERINFO'.
toolhelp.c(77): error: Syntax error; found 'ti' expecting ';'.
toolhelp.c(77): error: Undeclared identifier 'ti'.
toolhelp.c(79): error: Left operand of . has incompatible type 'int'.
toolhelp.c(81): warning: Missing prototype for 'TimerCount'.
toolhelp.c(84): error: Left operand of . has incompatible type 'int'.
toolhelp.c(84): warning: Overflow in converting constant expression from 'unsigned int' to 'unsigned short'.
toolhelp.c(85): error: Left operand of . has incompatible type 'int'.
toolhelp.c(85): warning: Overflow in converting constant expression from 'unsigned int' to 'unsigned short'.
toolhelp.c(94): warning: Illegal use of '__stdcall'.
toolhelp.c(94): error: Undefined size for '_export' with type 'void'.
toolhelp.c(94): error: Syntax error; found 'IntCallBack' expecting ';'.
toolhelp.c(94): warning: Missing type specifier.
toolhelp.c(100): warning: Missing return value.
toolhelp.c(107): warning: Missing prototype for 'TerminateApp'.
toolhelp.c(107): error: Undeclared identifier 'NO_UAE_BOX'.
toolhelp.c(94): error: Undefined size for '_export' with type 'void'.
toolhelp.c(94): warning: Static '_export' is not referenced.
Type: C >>>Couldn't build: toolhelp.obj<<<
Type: C >>>TMAKEOBJECT<<<
Type: C >>>TMAKEOBJECT:REFRESH<<<
Type: N >>> 1322<<<