Ring -- Curl -- Distributing a Console Application

43 views
Skip to first unread message

Bert Mariani

unread,
Jun 12, 2024, 1:21:58 PMJun 12
to The Ring Programming Language
Hello Mahmoud et ALL

I wrote this Curl program to fetch quotes from Yahoo.
   - Curl-Get-QHD.ring  
   - Quotes.ini 

Then I converted it to a Distribute - Console Application
   - Curl-Get-QHD,exe

From the CMD line, I change directories to where it is located
Then  copy/paste  -- Curl-Get-QHD.exe -- and hit enter
It runs FINE on my laptop ! See output below.

The problem is when I put it on a friend's laptop
  --- Error:    Cannot find  ring_libcurl.dll

Where would I install  ring_libcurl.dll   ?

I even downloaded and installed Ring-20 on the friend's laptop
Same error -- Cannot find  ring_libcurl.dll
A head scratcher !!

===================================
NOTE:  CURL:  Had to add UserAgent line to make it work 

curl = curl_easy_init()     ### START CURL INIT  
curl_easy_setopt(curl, CURLOPT_USERAGENT, "curl/7.54.1" )   # FIX "Too many requests"

 curl_easy_setopt(curl, CURLOPT_URL, $url);   ### <<<=== SetOpt + URL              
 cStr = curl_easy_perform_silent(curl)               ### <<<=== GET DATA - CALL CURL

====================================
RUN and OUTPUT

cd    c:\MyStuff\CurlApp-Distribute>
c:\MyStuff\CurlApp-Distribute>Curl-Get-QHD.exe
sysArgV: 1
Curl-Get-QHD.exe

Empty sysArgV: Insert sysArgV for Quotes

1  BLV  71.31   71.69   71.31   71.65   71.65   202103
2  QQQ  471.96  475.43  471.30  474.68  474.68  15744836
3  SPY  541.63  543.96  541.21  542.90  542.90  21042143
4  ^TNX 4.39    4.41    4.26    4.26    4.26    0
5  VTI  267.09  268.21  266.83  267.62  267.62  1452143
6  ZROZ 76.51   77.27   76.40   77.19   77.19   600722
7  ASML 1059.15 1077.22 1055.63 1071.46 1071.46 503083
8  ADBE 469.21  471.12  466.10  469.60  469.60  1228294
9  AMD  160.32  162.23  158.92  160.65  160.65  25998077
10  ABNB        150.12  150.27  149.10  149.49  149.49  1709511
11  ALGN        259.61  267.69  258.54  264.47  264.47  361424
12  AMZN        188.12  188.35  185.94  187.03  187.03  16570119
Finished: Quotes

c:\MyStuff\CurlApp-Distribute>
======================================
Quotes.ini
Curl-Get-QHD.ring

Mahmoud Fayed

unread,
Jun 12, 2024, 1:41:36 PMJun 12
to The Ring Programming Language
Hello Bert

Some notes:

(1) The executable version (32bit/64bit) must match the library version (32bit/64bit)

(2) If you will install Ring, then add ring/bin to the path
OR just add the DLLs files in the application folders (beside the application executable)

(3) You can test the distribution that you prepare (exe + dlls) on your machine 
Just rename ring folder to other name like (myring) so the system can't find it
Then run your program and see what happens

(4) If you are using Ring 32bit - Then another LibCurl file (libcurl.dll) is required too
This file exist in ring/bin folder, also it exist in this folder:  ring/extensions/libdepwin/LibCurl/bin at master · ring-lang/ring (github.com)

Greetings,
Mahmoud

Bert Mariani

unread,
Jun 12, 2024, 5:54:54 PMJun 12
to The Ring Programming Language
Hello Mahmoud

Thanks for the steps ... I am using Ring-20--64
 Ran to make sure:    ---   C:\ring\extensions\ringcurl\buildvc_x64.bat

Fails when C:\ring  is renamed as  C:\ring-bert
and  ring_libcurl.dll  and  Curl-Get-QHD.exe  are in the same directory

=====================================
 Directory of C:\MyStuff\CurlApp-Distribute

2024-06-11  10:17 AM           914,432 Curl-Get-QHD.exe
2024-06-11  10:17 AM            22,095 Curl-Get-QHD.ring
2024-04-11  11:05 AM           290,816 libcurl.dll            <<< copied this here anyway -- 32 bit
2024-06-10  10:25 AM               456 Quotes.ini
2024-06-12  05:26 PM               464 Quotes.result
2024-06-12  05:24 PM           910,848 ring_libcurl - Copy.dll
2024-06-12  05:24 PM           910,848 ring_libcurl.dll     <<<  64 bit version

=========================================
C:\ring   - Works

C:\MyStuff\CurlApp-Distribute>Curl-Get-QHD.exe

sysArgV: 1
Curl-Get-QHD.exe

Empty sysArgV: Insert sysArgV for Quotes

1  BLV  71.31   71.71   70.98   70.99   70.99   421612
2  QQQ  471.96  476.50  471.30  474.15  474.15  33193638
3  SPY  541.63  544.12  540.30  541.36  541.36  60222457
Finished: Quotes

===============================
C:\ring-bert    <<< Rename Ring   Fails

C:\MyStuff\CurlApp-Distribute>Curl-Get-QHD.exe

Library File : ring_libcurl.dll
Line 2 Error (R38) : Runtime Error in loading the dynamic library
In loadlib() in file Curl-Get-QHD.ring

C:\MyStuff\CurlApp-Distribute>

==============================

Mahmoud Fayed

unread,
Jun 13, 2024, 4:54:38 AMJun 13
to The Ring Programming Language
Hello Bert

I tried to create a separate folder to run the app
I have the next files which are enough to run it on my machine (Windows 11)
appfiles.png

I just added ring.dll and ring_libcurl.dll

By checking ring_libcurl.dll dependency I get the next results
depends.png

I know that you tried using ring.dll and ring_libcurl.dll and this was not enough to run the app on your machine
The good news is when your path include ring/bin you can run the app
So, the files that you need exist in ring/bin folder

So, try this old school procedure
Copy DLL files from ring/bin to your app folder
Run the app (should work now)
Then continue by deleting some files then run the app again until the app stop working to know what files exactly was required

These files could be related to C runtime files listed here: ring/tools/ring2exe/libs/cruntime.ring at master · ring-lang/ring (github.com)

Greetings,
Mahmoud

Mahmoud Fayed

unread,
Jun 13, 2024, 5:12:24 AMJun 13
to The Ring Programming Language
Hello Bert

>> "Then I converted it to a Distribute - Console Application"

Please use:

ring2exe Curl-Get-QHD.ring 

This will produce Curl-Get-QHD.exe which uses ring.dll file

Greetings,
Mahmoud
On Wednesday, June 12, 2024 at 8:21:58 PM UTC+3 Bert Mariani wrote:

Mansour Ayouni

unread,
Jun 13, 2024, 9:21:50 AMJun 13
to Mahmoud Fayed, The Ring Programming Language
Hello Bert,

As a side note to the discussion, try not to use special chars like "-" in file names and replace it with an underscore if you want.

Best,
Mansour

--

---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ring-lang/a408a814-765a-4993-ae22-b37738665713n%40googlegroups.com.

Bert Mariani

unread,
Jun 13, 2024, 9:29:36 AMJun 13
to The Ring Programming Language
Hello Mahmoud

The following Worked !! Thanks !!
See list of required DLL's

===============================================
Generate

c:\MyStuff\CurlApp-Distribute> ring2exe  Curl-Get-QHD.ring      <<< generate EXE

------------------------------------------------------------------
 Directory of c:\MyStuff\CurlApp-Distribute
       ..
2024-06-13  08:59 AM           445,440 Curl-Get-QHD.exe   <<< old was 914,432 Curl-Get-QHD.exe from Console App)

2024-06-11  10:17 AM             22,095 Curl-Get-QHD.ring
2024-06-10  10:25 AM                  456 Quotes.ini
2024-06-13  09:12 AM                  464 Quotes.result
2024-04-11  12:12 PM           586,752 ring.dll                  <<<  needed from  c:\ring\bin
2024-06-12  05:24 PM           910,848 ring_libcurl.dll     <<<  64-bit version from  C:\ring\extensions\ringcurl
               6 File(s)      1,966,055 bytes
               2 Dir(s)  295,903,432,704 bytes free

-------------------------------------------------------
RUN & Output

c:\MyStuff\CurlApp-Distribute>
c:\MyStuff\CurlApp-Distribute> Curl-Get-QHD.exe
sysArgV: 1
Curl-Get-QHD.exe

Empty sysArgV: Insert sysArgV for Quotes

1  BLV  71.31   71.71   70.98   70.99   70.99   421612
2  QQQ  471.96  476.50  471.30  474.15  474.15  33193638
3  SPY  541.63  544.12  540.30  541.36  541.36  60222457
4  ^TNX 4.31    4.31    4.24    4.27    4.27    0
5  VTI  267.09  268.21  266.21  266.77  266.77  2758873
6  ZROZ 76.51   77.50   76.01   76.13   76.13   913592
7  ASML 1059.15 1077.22 1055.63 1068.86 1068.86 974239
Finished: Quotes

c:\MyStuff\CurlApp-Distribute>
---------------------------------------------------------------

Mahmoud Fayed

unread,
Jun 13, 2024, 9:51:34 AMJun 13
to The Ring Programming Language
Hello Bert

>> "The following Worked !! Thanks !!"

You are welcome :D

Greetings,
Mahmoud
Reply all
Reply to author
Forward
0 new messages