MSVC 2017 Try

Verhoven
Posts: 435
Joined: Sun Oct 09, 2005 7:23 pm

Re: MSVC 2017 Try

Post by Verhoven »

That line is only:
extern "C" {


Another issue is that when I change in the compiler -TC by -TP the the previous error gey solved but the number of other new errors increases, like this:

1.-
no se puede realizar la conversión de 'char *' a 'unsigned char'
la operación requiere reinterpret_cast, conversión de estilo de C o conversión de estilo de función.

2.-
'int_sprintf(char *const, const char *const, ...)': el argumento 1 no puede convertirse de 'unsigned char [8]' a 'char *const'

3.-
hbapifs.h(454): error C2732: la especificación de vinculación se contradice con la especificación anterior para 'hb_fopen'
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: MSVC 2017 Try

Post by Antonio Linares »

You have to solve each error, step by step

Please report the code here and its for each one of them
regards, saludos

Antonio Linares
www.fivetechsoft.com
Verhoven
Posts: 435
Joined: Sun Oct 09, 2005 7:23 pm

Re: MSVC 2017 Try

Post by Verhoven »

1.- error (warning):
internet.prg(441): warning C4302: 'conversi¢n de tipo': truncamiento de 'HINTERNET' a 'LONG'
internet.prg(446): warning C4312: 'conversi¢n de tipo': conversi¢n de 'long' a 'HINTERNET' de mayor tama¤o

Code:

Code: Select all

line 441:      hb_retnl( ( LONG ) FtpFindFirstFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), ( WIN32_FIND_DATA * ) hb_parc( 3 ), hb_parnl( 4 ), hb_parnl( 5 ) ) );

line 446:      BOOL lSuccess = InternetFindNextFile( ( HINTERNET ) hb_parnl( 1 ), ( WIN32_FIND_DATA * ) hb_parc( 2 ) ) ;
2.- error:
C:\harbour64_4_MVSC2017\include\hbapifs.h(454): error C2732: la especificaci¢n de vinculaci¢n se contradice con la especificaci¢n anterior para 'hb_fopen'
C:\harbour64_4_MVSC2017\include\hbapifs.h(454): note: vea la declaraci¢n de 'hb_fopen'

Code:

Code: Select all

       /* wrapper to fopen() which calls hb_fsNameConv() */
line 454:   extern HB_EXPORT FILE *       hb_fopen( const char *path, const char *mode );

                HB_EXTERN_END
3.- error:
error C2440: 'inicializando': no se puede realizar la conversi¢n de 'char *' a 'unsigned char *'
note: Los tipos se¤alados no est n relacionados; la conversi¢n requiere reinterpret_cast, conversi¢n de estilo de C o conversi¢n de estilo de funci¢n

Code:

Code: Select all

unsigned char *pucBuffer= (char *) hb_parc(1);

4.- error:
error C2664: 'int sprintf(char *const ,const char *const ,...)': el argumento 1 no puede convertirse de 'unsigned char [8]' a 'char *const '
note: Los tipos se¤alados no est n relacionados; la conversi¢n requiere reinterpret_cast, conversi¢n de estilo de C o conversi¢n de estilo de funci¢n

Code:

Code: Select all

sprintf(mensaje, "%0x", ~ulCrc);

5.- error:
error C2664: 'void hb_retc(const char *)': el argumento 1 no puede convertirse de 'unsigned char [8]' a 'const char *'
note: Los tipos se¤alados no est n relacionados; la conversi¢n requiere reinterpret_cast, conversi¢n de estilo de C o conversi¢n de estilo de funci¢n

Code:

Code: Select all

hb_retc( mensaje );

6.- error:
error C2440: 'inicializando': no se puede realizar la conversi¢n de 'char *' a 'unsigned char *'
note: Los tipos se¤alados no est n relacionados; la conversi¢n requiere reinterpret_cast, conversi¢n de estilo de C o conversi¢n de estilo de funci¢n

Code:

Code: Select all

unsigned char *pucData=(char *) hb_parc( 1 );
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: MSVC 2017 Try

Post by Antonio Linares »

1.

Modifica este código:

( HINTERNET ) hb_parnl( 1 )

así:

( HINTERNET ) hb_parnll( 1 )
regards, saludos

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

Re: MSVC 2017 Try

Post by Antonio Linares »

2.

Comenta esta línea. No hace falta:

line 454: extern HB_EXPORT FILE * hb_fopen( const char *path, const char *mode );

// extern HB_EXPORT FILE * hb_fopen( const char *path, const char *mode );

puedes borrarla directamente
regards, saludos

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

Re: MSVC 2017 Try

Post by Antonio Linares »

3.

Modifica esta línea:

unsigned char *pucBuffer= (char *) hb_parc(1);

así:

unsigned char *pucBuffer= (unsigned char *) hb_parc(1);
regards, saludos

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

Re: MSVC 2017 Try

Post by Antonio Linares »

4.

Prueba a cambiar esta línea:

sprintf(mensaje, "%0x", ~ulCrc);

así

sprintf( ( char * const ) mensaje, "%0x", ~ulCrc);
regards, saludos

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

Re: MSVC 2017 Try

Post by Antonio Linares »

5.

Cambia esta línea:

hb_retc( mensaje );

así:

hb_retc( ( const char * ) mensaje );
regards, saludos

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

Re: MSVC 2017 Try

Post by Antonio Linares »

6.

Cambia esta línea:

unsigned char *pucData=(char *) hb_parc( 1 );

asi

unsigned char *pucData=(unsigned char *) hb_parc( 1 );
regards, saludos

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

Re: MSVC 2017 Try

Post by Antonio Linares »

El compilador de C nos dice en sus mensajes de error lo que tenemos que corregir :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Verhoven
Posts: 435
Joined: Sun Oct 09, 2005 7:23 pm

Re: MSVC 2017 Try

Post by Verhoven »

Aún persisten algunos errores:
internet.prg(387): warning C4244: 'argumento': conversi¢n de 'HB_LONGLONG' a 'DWORD'; posible p‚rdida de datos
internet.prg(387): warning C4311: 'conversi¢n de tipo': truncamiento de puntero de 'HINTERNET' a 'LONG'
internet.prg(387): warning C4302: 'conversi¢n de tipo': truncamiento de 'HINTERNET' a 'LONG'
internet.prg(399): warning C4244: 'argumento': conversi¢n de 'HB_LONGLONG' a 'DWORD'; posible p‚rdida de datos
internet.prg(399): warning C4311: 'conversi¢n de tipo': truncamiento de puntero de 'HINTERNET' a 'LONG'
internet.prg(399): warning C4302: 'conversi¢n de tipo': truncamiento de 'HINTERNET' a 'LONG'
internet.prg(406): warning C4244: 'argumento': conversi¢n de 'HB_LONGLONG' a 'DWORD'; posible p‚rdida de datos
internet.prg(406): warning C4311: 'conversi¢n de tipo': truncamiento de puntero de 'HINTERNET' a 'LONG'
internet.prg(406): warning C4302: 'conversi¢n de tipo': truncamiento de 'HINTERNET' a 'LONG'
internet.prg(434): warning C4244: 'argumento': conversi¢n de 'HB_LONGLONG' a 'DWORD'; posible p‚rdida de datos
internet.prg(441): warning C4244: 'argumento': conversi¢n de 'HB_LONGLONG' a 'DWORD'; posible p‚rdida de datos
internet.prg(441): warning C4311: 'conversi¢n de tipo': truncamiento de puntero de 'HINTERNET' a 'LONG'
internet.prg(441): warning C4302: 'conversi¢n de tipo': truncamiento de 'HINTERNET' a 'LONG'
internet.prg(466): warning C4244: 'argumento': conversi¢n de 'HB_LONGLONG' a 'DWORD'; posible p‚rdida de datos
internet.prg(533): warning C4244: 'argumento': conversi¢n de 'HB_LONGLONG' a 'DWORD'; posible p‚rdida de datos
internet.prg(592): warning C4244: 'argumento': conversi¢n de 'HB_LONGLONG' a 'DWORD'; posible p‚rdida de datos


Y a pesar de haber metido el siguiente código pruesto para solucionar el error de _iob

Code: Select all

//*PARA COMPATIBILIDAD CON MVSC 2017
 //  NO FUNCIONA: 15/04/2017  -  CODIGO EN COMPROBACIÓN
#pragma BEGINDUMP

#include <Windows.h>

extern "C" {
FILE * _iob[] = { stdin, stdout, stderr };

FILE * __iob_func( void )
{
return ( FILE * ) _iob;
}
}

#pragma ENDDUMP

Salen los siguientes errores:


libucrt.lib(_file.obj) : error LNK2005: ya se definió _iob en wintpv.obj

wintpv.obj : error LNK2019: símbolo externo "struct _iobuf * __cdecl hb_fopen(char const *,char const *)" (?hb_fopen@@YAPEAU_iobuf@@PEBD0@Z) sin resolver al que se hace referencia en la función HB_FUN_FTP_DIR2DIRFTP

FiveHC64.lib(FWPNG.obj) : error LNK2019: símbolo externo png_init_io sin resolver al que se hace referencia en la función save_png_to_file
wintpv_64.EXE : fatal error LNK1120: 2 externos sin resolver
* Linking errors *
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: MSVC 2017 Try

Post by Antonio Linares »

> conversi¢n de 'HB_LONGLONG' a 'DWORD'; posible p‚rdida de datos

Al pasar de 32 bits a 64 bits, en vez de usar hb_parnl() hemos de usar hb_parnll() y en vez de hb_retnl() usar hb_retnll()

Modifica esta línea:

FILE * _iob[] = { stdin, stdout, stderr };

asi:

static FILE * _iob[] = { stdin, stdout, stderr };
regards, saludos

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

Re: MSVC 2017 Try

Post by Antonio Linares »

Tienes que compilar el módulo wintpv usando C y no C++

Es wintpv.prg ? Contiene código en C ?

En caso de ser un módulo en C, usa el flag /TC
regards, saludos

Antonio Linares
www.fivetechsoft.com
Verhoven
Posts: 435
Joined: Sun Oct 09, 2005 7:23 pm

Re: MSVC 2017 Try

Post by Verhoven »

No funciona Antonio.

Copio el código que meto al final del módulo wintpv.prg para solucionar el error de la función _iob[] :
Para poderlo compilar tengo que poner en el compilador el flag -TP, como lo haga con -TC da error C2059: error de sintaxis 'cadena' en la línea que con tiene el código
extern "C" {

Code: Select all

//*PARA COMPATIBILIDAD CON MVSC 2017
 //  NO FUNCIONA: 15/04/2017  -  CODIGO EN COMPROBACIÓN
#pragma BEGINDUMP

#include <Windows.h>

extern "C" {
//FILE * _iob[] = { stdin, stdout, stderr };
static FILE * _iob[] = { stdin, stdout, stderr };

FILE * __iob_func( void )
{
return ( FILE * ) _iob;
}
}

#pragma ENDDUMP
Copio también el modulo .bat para construir el exe:

Code: Select all

@ECHO OFF
CLS
ECHO ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
ECHO ³ FWH 64 for Harbour 14.07 (MSVC++) Jul.2014       Harbour development power ³Ü
ECHO ³ (c) FiveTech, 1993-2014   for Microsoft Windows 9X/NT/200X/ME/XP/Vista/7/8 ³Û
ECHO ³                                                 W-10                       ³Û
ECHO ³                      Modificación Verhoven 13/04/2017                      ³Û
ECHO ³                MS Visual Studio Comunity 2017 para 64 Bits                 ³Û
ECHO ³     Incluye llamada al Browse de Hernan compilado también para 64 Bits.    ³Û
ECHO ³                                                                            ³Û
ECHO ³     Carpetas de la instalación para que funcione este bat:                 ³Û
ECHO ³             FWH 64:      C:\FWH64                                          ³Û
ECHO ³             Harbour 64:  C:\harbour64                                      ³Û
ECHO ³             MVSC 2017:   En la que instala por defecto                     ³Û
ECHO ³                                                                            ³Û
ECHO ³     Aplicado el .bat sobre MIPROG.PRG genera MIPROG_64.EXE                 ³Û
ECHO ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÛ
ECHO ÿ ßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßßß

if A%1 == A GOTO :SINTAX
if NOT EXIST %1.prg GOTO :NOEXIST

@set oldpath=%path%
@set oldinclude=%include%
@set oldlib=%lib%
@set oldlibpath=%libpath%

rem **** Version 2017
set HB_WITH_OPENSSL=c:\OpenSSL-Win32\include
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" call "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
rem **** Version 2017 FIN

rem if "%FWDIR%" == "" set FWDIR=.\..
if "%FWDIR%" == "" set FWDIR=C:\FWH64
if "%HBDIR%" == "" set HBDIR=C:\harbour64_4_MVSC2017

if "%FWDIR%" == "C:\fwh" set FWDIR=C:\FWH64
if "%HBDIR%" == "C:\harbour" set HBDIR=C:\harbour64_4_MVSC2017

ECHO Compiling...

set hdir=%HBDIR%
rem set hdirl=%hdir%\lib\vc64
set hdirl=%hdir%\lib

%hdir%\bin\harbour %1 /n /i%fwdir%\include;%hdir%\include /p /d__64__ %2 %3 > comp.log 2> warnings.log
IF ERRORLEVEL 1 GOTO COMPILEERROR
@type comp.log
@type warnings.log

rem Compila en C++
 cl -TP -W3 -O2 -c -I%hdir%\include %1.c

rem Compila en C
rem cl -TC -W3 -O2 -c -I%hdir%\include %1.c

:ENDCOMPILE

IF EXIST %1.rc rc -r -D__64__ %1

echo %1.obj  > msvc.tmp

rem TBROWSE DE HERNAN:
rem ­ Hay que poner delante las que sustituyen a las de FW, o mejor dicho
rem    el enlazador pone en el exe las que primero encuentra !
echo C:\CLIWIN\TBROWSE17b\LIB\TWBRWX64_H.lib >> msvc.tmp


echo %fwdir%\lib\FiveH64.lib %fwdir%\lib\FiveHC64.lib  >> msvc.tmp

echo %hdirl%\hbrtl.lib  >> msvc.tmp
echo %hdirl%\hbvm.lib  >> msvc.tmp
echo %hdirl%\gtgui.lib  >> msvc.tmp
echo %hdirl%\hblang.lib  >> msvc.tmp
echo %hdirl%\hbmacro.lib  >> msvc.tmp
echo %hdirl%\hbrdd.lib  >> msvc.tmp
echo %hdirl%\rddntx.lib  >> msvc.tmp
echo %hdirl%\rddcdx.lib  >> msvc.tmp
echo %hdirl%\rddfpt.lib  >> msvc.tmp
echo %hdirl%\hbsix.lib  >> msvc.tmp
echo %hdirl%\hbdebug.lib  >> msvc.tmp
echo %hdirl%\hbcommon.lib  >> msvc.tmp
echo %hdirl%\hbpp.lib  >> msvc.tmp
echo %hdirl%\hbcpage.lib  >> msvc.tmp
echo %hdirl%\hbwin.lib  >> msvc.tmp
echo %hdirl%\hbct.lib  >> msvc.tmp
echo %hdirl%\hbziparc.lib >> msvc.tmp
echo %hdirl%\hbmzip.lib >> msvc.tmp
echo %hdirl%\hbzlib.lib >> msvc.tmp
echo %hdirl%\hbpcre.lib >> msvc.tmp
echo %hdirl%\minizip.lib >> msvc.tmp
echo %hdirl%\xhb.lib >> msvc.tmp
echo %hdirl%\hbcplr.lib >> msvc.tmp
echo %hdirl%\png.lib >> msvc.tmp

echo %hdir%\lib\hbcomm.lib >> msvc.tmp

rem Uncomment these two lines to use Advantage RDD
rem echo %hdirl%\rddads.lib >> msvc.tmp
rem echo %hdirl%\ace32.lib >> msvc.tmp

echo kernel32.lib  >> msvc.tmp
echo user32.lib    >> msvc.tmp
echo gdi32.lib     >> msvc.tmp
echo winspool.lib  >> msvc.tmp
echo comctl32.lib  >> msvc.tmp
echo comdlg32.lib  >> msvc.tmp
echo advapi32.lib  >> msvc.tmp
echo shell32.lib   >> msvc.tmp
echo ole32.lib     >> msvc.tmp
echo oleaut32.lib  >> msvc.tmp
echo uuid.lib      >> msvc.tmp
echo odbc32.lib    >> msvc.tmp
echo odbccp32.lib  >> msvc.tmp
echo iphlpapi.lib  >> msvc.tmp
echo mpr.lib       >> msvc.tmp
echo version.lib   >> msvc.tmp
echo wsock32.lib   >> msvc.tmp
echo msimg32.lib   >> msvc.tmp
echo oledlg.lib    >> msvc.tmp
echo psapi.lib     >> msvc.tmp
echo gdiplus.lib   >> msvc.tmp
echo winmm.lib     >> msvc.tmp

echo wininet.lib  >> msvc.tmp
echo ws2_32.lib  >> msvc.tmp
echo urlmon.lib  >> msvc.tmp

rem echo %ProgramFiles%(x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64\wininet.lib  >> msvc.tmp
rem echo %ProgramFiles%(x86)\Microsoft SDKs\Windows\v7.1A\Lib\x64\ws2_32.lib  >> msvc.tmp

IF EXIST %1.res echo %1.res >> msvc.tmp

rem link @msvc.tmp /nologo /subsystem:windows /force:multiple /NODEFAULTLIB:libc
link @msvc.tmp /nologo /subsystem:windows /NODEFAULTLIB:libc /OUT:%1_64.EXE

IF ERRORLEVEL 1 GOTO LINKERROR
ECHO * Application successfully built *
@set path=%oldpath%
@set include=%oldinclude%
@set lib=%oldlib%
@set libpath=%oldlibpath%
@set oldpath=""
@set oldinclude=""
@set oldlib=
@set oldlibpath=

rem delete temporary files
@del %1.c
@del %1.obj
@del %1.ppo
@del msvc.tmp
@del comp.log
@del warnings.log
%1_64.EXE
GOTO EXIT
ECHO

:COMPILEERROR
@type comp.log
ECHO * Compiling errors *
GOTO EXIT

:LINKERROR
ECHO * Linking errors *
GOTO EXIT

:SINTAX
ECHO    SYNTAX: Build [Program]     {-- No especifiques la extensi¢n PRG
ECHO                                {-- Don't specify .PRG extension
GOTO EXIT

:NOEXIST
ECHO The specified PRG %1 does not exist

:EXIT
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: MSVC 2017 Try

Post by Antonio Linares »

y que errores te da ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply