Page 1 of 2

compile errors - send a SMS

PostPosted: Thu Apr 11, 2024 2:18 pm
by Jeff Barnes
Hi all,

I'm trying to compile a sample of using curl with Twilio.
I've linked in hbcurl.lib, libcurl.lib and hbcurl.ch

I get the following errors. Anyone know what I'm missing?

Code: Select all  Expand view

Turbo Incremental Link 6.80 Copyright (c) 1997-2017 Embarcadero Technologies, Inc.
Error: Unresolved external '_hb_gcMark' referenced from C:\HARBOUR\LIB\HBCURL.LIB|core
Error: Unresolved external '_hb_gcAllocate' referenced from C:\HARBOUR\LIB\HBCURL.LIB|core
Error: Unresolved external '_hb_storclen_buffer' referenced from C:\HARBOUR\LIB\HBCURL.LIB|core
Error: Unresolved external '_hb_parnldef' referenced from C:\HARBOUR\LIB\HBCURL.LIB|core
Error: Unable to perform link
* Linking errors *
 

Re: compile errors

PostPosted: Thu Apr 11, 2024 2:26 pm
by Antonio Linares
Dear Jeff,

Are you using xHarbour or Harbour ?

It seems as those libraries are for Harbour and not for xHarbour, thus those unresolved externals availables only for Harbour

Re: compile errors

PostPosted: Thu Apr 11, 2024 2:43 pm
by Jeff Barnes
Hi Antonio

I'm using xharbour. Are there any libs for using curl with xharbour?

Re: compile errors

PostPosted: Thu Apr 11, 2024 2:45 pm
by Jeff Barnes
If I try with harbour I get these errors:

Code: Select all  Expand view

Turbo Incremental Link 6.80 Copyright (c) 1997-2017 Embarcadero Technologies, Inc.
Error: Unresolved external '_HB_FUN_HB_BLEN' referenced from C:\FWH1611\LIB\FIVEH.LIB|OLEFUNCS
Error: Unresolved external '_HB_FUN___OLEVARIANTNEW' referenced from C:\FWH1611\LIB\FIVEH.LIB|ADOFUNCS
Error: Unresolved external '_HB_FUN_OCCURS' referenced from C:\FWH1611\LIB\FIVEH.LIB|XBROWSE
Error: Unresolved external '_hb_extIsNil' referenced from C:\FWH1611\LIB\FIVEHC.LIB|RICHEDIT
Error: Unresolved external '_HB_FUN_HB_TSTOUTC' referenced from C:\FWH1611\LIB\FIVEH.LIB|VALTOSTR
Error: Unable to perform link
* Linking errors *
 

Re: compile errors

PostPosted: Thu Apr 11, 2024 2:49 pm
by Antonio Linares
Dear Jeff,

Could you please post the source code of the example here so we can test it ?

thanks

Re: compile errors

PostPosted: Thu Apr 11, 2024 2:49 pm
by Enrico Maria Giordano
Jeff, it looks as you are mixing Harbour and xHarbour libraries. Please double check.

Re: compile errors

PostPosted: Thu Apr 11, 2024 2:56 pm
by Enrico Maria Giordano
Jeff Barnes wrote:If I try with harbour I get these errors:

Code: Select all  Expand view

Turbo Incremental Link 6.80 Copyright (c) 1997-2017 Embarcadero Technologies, Inc.
Error: Unresolved external '_HB_FUN_HB_BLEN' referenced from C:\FWH1611\LIB\FIVEH.LIB|OLEFUNCS
Error: Unresolved external '_HB_FUN___OLEVARIANTNEW' referenced from C:\FWH1611\LIB\FIVEH.LIB|ADOFUNCS
Error: Unresolved external '_HB_FUN_OCCURS' referenced from C:\FWH1611\LIB\FIVEH.LIB|XBROWSE
Error: Unresolved external '_hb_extIsNil' referenced from C:\FWH1611\LIB\FIVEHC.LIB|RICHEDIT
Error: Unresolved external '_HB_FUN_HB_TSTOUTC' referenced from C:\FWH1611\LIB\FIVEH.LIB|VALTOSTR
Error: Unable to perform link
* Linking errors *
 


Try to link xhb.lib and let us know the result.

Re: compile errors

PostPosted: Thu Apr 11, 2024 2:56 pm
by Enrico Maria Giordano
Antonio Linares wrote:Dear Jeff,

Could you please post the source code of the example here so we can test it ?

thanks


+1

Re: compile errors

PostPosted: Thu Apr 11, 2024 3:01 pm
by Jeff Barnes
This is the code I'm trying to compile.

Code: Select all  Expand view

#include "FiveWin.ch"
#include "directry.ch"
#include "FileIO.ch"
#include "Common.ch"
#include "hbclass.ch"
#include "C:\Harbour\Include\hbcurl.ch"

#define ACCOUNT_SID  "XxxxxxxxXxXXXX"
#define AUTH_TOKEN   "Twilio-Acc-Token"
#define TEL_FROM     "YourTwilioNumber"
#define TEL_TO       "555-555-5555"

FUNCTION SendSMS()
   LOCAL hCurl, nError, httpcode
   LOCAL cUrl     := "https://api.twilio.com/2010-04-01/Accounts/" + ACCOUNT_SID + "/Messages.json"
   LOCAL cPostFields := 'To='    + TEL_TO +;
                        "&From=" + TEL_FROM +;
                        "&Body=" + Time() + " SMS From TestTwilio.exe"

   curl_global_init()

   IF ! EMPTY( hCurl := curl_easy_init() )
      curl_easy_setopt( hCurl, HB_CURLOPT_POST, 1 )
      curl_easy_setopt( hCurl, HB_CURLOPT_URL, cUrl )
      curl_easy_setopt( hcurl, HB_CURLOPT_POSTFIELDS, cPostFields )
      curl_easy_setopt( hCurl, HB_CURLOPT_USERPWD, ACCOUNT_SID + ':' + AUTH_TOKEN )
      curl_easy_setopt( hCurl, HB_CURLOPT_DL_BUFF_SETUP )
      curl_easy_setopt( hCurl, HB_CURLOPT_VERBOSE, 1 )
      curl_easy_setopt( hCurl, HB_CURLOPT_SSL_VERIFYPEER, .F. )
      nError := curl_easy_perform( hCurl )
      curl_easy_getinfo( hCurl, HB_CURLINFO_RESPONSE_CODE, @httpcode )
   ENDIF
   curl_global_cleanup()
RETURN NIl

 

Re: compile errors

PostPosted: Thu Apr 11, 2024 3:05 pm
by Jeff Barnes
Same errors if I add in xhb.lib

Re: compile errors

PostPosted: Thu Apr 11, 2024 3:09 pm
by Antonio Linares
Dear Jeff,

You can download from https://github.com/FiveTechSoft/harbour_and_xharbour_builds the most recent Harbour and xHarbour builds just to be sure you have all the right libs

In the list of builds, please look for the most recent dates

Re: compile errors

PostPosted: Thu Apr 11, 2024 3:16 pm
by Enrico Maria Giordano
This is the error:

Code: Select all  Expand view
#include "C:\Harbour\Include\hbcurl.ch"


Please replace it with

Code: Select all  Expand view
#include "hbcurl.ch"


Compiles fine here. And please use latest Harbour and xHarbour builds:

https://github.com/FiveTechSoft/harbour_and_xharbour_builds
http://xharbour.org/index.asp?page=download/windows/binaries_win

Re: compile errors

PostPosted: Thu Apr 11, 2024 3:25 pm
by Jeff Barnes
I've updated the harbour files and made the changes mentioned above.
Done to 1 error now:

Turbo Incremental Link 6.80 Copyright (c) 1997-2017 Embarcadero Technologies, Inc.
Error: Unresolved external '___get_std_stream' referenced from C:\HARBOUR\LIB\HBVM.LIB|fm
Error: Unable to perform link
* Linking errors *

Re: compile errors

PostPosted: Thu Apr 11, 2024 3:59 pm
by Jeff Barnes
I found this in the fourms...

#pragma BEGINDUMP
void __get_std_stream() {}
void _chdir() {}
#pragma ENDDUMP

I added that and it compiles but when I run the program I get an error:

"The procedure entry point curl_mime_addpart could not be
located in the dynamic link library C:\Certus\CertusPIN2.exe"

Any ideas?

Re: compile errors

PostPosted: Thu Apr 11, 2024 4:02 pm
by Jeff Barnes
scratch the last message.
I forgot to update libcurl.dll

No errors now.

By adding this code, does it affect anything?

Code: Select all  Expand view

#pragma BEGINDUMP
void __get_std_stream() {}
void _chdir() {}
#pragma ENDDUMP