Problem with CURL and DLL's

221 views
Skip to first unread message

gvar...@gmail.com

unread,
Jul 16, 2021, 2:32:33 PM7/16/21
to Harbour Users
[Google Traductor]
Hi good day
The PRG code that I paste below, works well on my PC putting the minGW compiler folder in the path, (in my case c:\hb32\comp\mingw\bin) through the following command:
SET PATH=c:\hb32\comp\mingw\bin;% PATH%

When I take it to another PC, it asks me for a list of DLL's, which I copy from c:\hb32\comp\mingw\bin to the folder where the EXE is, but when I run it, it gives me the following message:
. . .
Press any key to continue ...
Problem with the SSL CA cert (path? Access rights?)
Press any key to continue ...
. . .

The DLLs that it asks me are:

libbrotlicommon.dll
libbrotlidec.dll
libcrypto-1_1.dll
libcurl-4.dll
libgcc_s_dw2-1.dll
libiconv-2.dll
libidn2-0.dll
libintl-8.dll
libnghttp2-14.dll
libpsl-5.dll
libssl-1_1.dll
libunistring-2.dll
libwinpthread-1.dll
zlib1.dll

How can I run the EXE on the target PC without having to install Harbor?
Is there a way to make a self-contained EXE?

Thank you very much in advance for your help.

. . . . Code.prg
#require "hbcurl"
#include "hbcurl.ch"
#include "inkey.ch"

FUNCTION Main

LOCAL hCurl, cToken, cRuc, hHash, aHeader := {}, cRpta

cToken := "apis-token-583.IffknbAo0LGsYLyKGWIUmz7290F70vsK"
cRuc := "20525754783"

AADD( aHeader, 'Accept: application/json' )
AADD( aHeader, 'Referer: http://apis.net.pe/api-ruc' )
AADD( aHeader, 'Authorization: Bearer ' + cToken )

setmode( 25, 80 )

wait
// curl_global_init( HB_CURL_GLOBAL_ALL )
IF ! empty( hCurl := curl_easy_init() )
curl_easy_setopt( hCurl, HB_CURLOPT_URL, "https://api.apis.net.pe/v1/ruc?numero=" + cRuc )
curl_easy_setopt( hCurl, HB_CURLOPT_HTTPHEADER, aHeader )
curl_easy_setopt( hCurl, HB_CURLOPT_DOWNLOAD )
curl_easy_setopt( hCurl, HB_CURLOPT_DL_BUFF_SETUP )
curlErr := curl_easy_perform( hCurl )

IF empty( curlErr )
cRpta := curl_easy_dl_buff_get( hCurl )
? cRpta
hb_jsonDecode( curl_easy_dl_buff_get( hCurl ), @hHash )
ELSE
? curl_easy_strerror(curlErr)
endif
curl_easy_reset( hCurl )
hCurl := NIL
ELSE
Alert( "Falló comando " + "!empty( hCurl := curl_easy_init() )" )
ENDIF
wait
// curl_global_cleanup( hCurl )
RETURN NIL

. . . .

[SPANISH]
Problema con CURL y DLL's
Hola, buen día
El código PRG que pego mas abajo, funciona bien en mi PC poniendo en la ruta la carpeta del compilador minGW, (en mi caso c:\hb32\comp\mingw\bin) a traves del siguiente comando:
SET PATH=c:\hb32\comp\mingw\bin;%PATH%

Cuando lo llevo a otra PC me pide una relación de DLL's, la cual copio desde c:\hb32\comp\mingw\bin hacia la carpeta donde está el EXE, pero al ejecutarlo me da el siguiente mensaje:
. . .
Press any key to continue...
Problem with the SSL CA cert (path? access rights?)
Press any key to continue...
. . .

Los DLL que me pide son: 

libbrotlicommon.dll
libbrotlidec.dll
libcrypto-1_1.dll
libcurl-4.dll
libgcc_s_dw2-1.dll
libiconv-2.dll
libidn2-0.dll
libintl-8.dll
libnghttp2-14.dll
libpsl-5.dll
libssl-1_1.dll
libunistring-2.dll
libwinpthread-1.dll
zlib1.dll

¿Cómo puedo hacer para ejecutar el EXE el la PC destino sin tener que instalar Harbour?
¿Hay alguna forma de hacer un EXE autocontenido?

De antemano muchas gracias por su ayuda.

GVARONAS

mstuff kstuff

unread,
Jul 16, 2021, 8:27:19 PM7/16/21
to Harbour Users
I use a compile an link.bat file;
set path=D:\PRG\hb\hb32\bin\;D:\PRG\hb\hb32\lib\;D:\PRG\hb\hb32\include\
REM without a ",%path%" // windos will reset it to %path% when the batch file completes its job.
rem make sure the drive and path include bin and lib and include.
hbmk2.exe prg_name -gui -trace -lhbct
MikeK
Reply all
Reply to author
Forward
0 new messages