NO

Author Topic: Pelles-C and CURL  (Read 8133 times)

alderman

  • Guest
Pelles-C and CURL
« on: November 27, 2017, 12:16:31 AM »
Hello, Pelles friends

1- Can CURL be used in Pelles-C
2- Is there a CURL package for Pelles-C
3- How to convert if needed
4- How to add CURL to Pelles-C


Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2101
Re: Pelles-C and CURL
« Reply #1 on: November 27, 2017, 06:01:24 PM »
  • I have not tested, but I don't see any reason that should prevent the use of the MSVC precompiled version
  • Not yet
For points 3 & 4 I'm not sure to have understood what you mean.
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

alderman

  • Guest
Re: Pelles-C and CURL
« Reply #2 on: November 27, 2017, 09:57:53 PM »
  • I have not tested, but I don't see any reason that should prevent the use of the MSVC precompiled version
  • Not yet
For points 3 & 4 I'm not sure to have understood what you mean.

There are two libs with the same name, I mean this:
https://curl.haxx.se/

I found a curl built for LccWin32:
http://www.q-software-solutions.de/~frido/
(At the bottom) old but it may get well.

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2101
Re: Pelles-C and CURL
« Reply #3 on: December 02, 2017, 06:33:49 PM »
This is a sample of use of a precompiled libcurl.
I compiled url2file demo using Stefan Kanthak libraries that you can download from here.
I included the relevant libraries in the example.
Note that the demo execute in the library folder so the executable can find the DLL.

I'll try to create a PellesC port when I'll have time
« Last Edit: December 02, 2017, 06:47:37 PM by frankie »
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

alderman

  • Guest
Re: Pelles-C and CURL
« Reply #4 on: December 02, 2017, 10:40:39 PM »
This is a sample of use of a precompiled libcurl.
I compiled url2file demo using Stefan Kanthak libraries that you can download from here.
I included the relevant libraries in the example.
Note that the demo execute in the library folder so the executable can find the DLL.

I'll try to create a PellesC port when I'll have time
I'll look at it. Thanks!
Interesting that you are thinking of port it to PellesC, I look forward to it.

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2101
Re: Pelles-C and CURL
« Reply #5 on: February 18, 2019, 12:03:57 AM »
I wasn't aware that Curl was already tuned for PellesC!  :o
Anyway I produced a port, 32/64bits, availabe on github.
The sample is compiled with Windows Security Support Provider Interface (SSPI).
« Last Edit: February 18, 2019, 12:06:49 AM by frankie »
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

alderman

  • Guest
Re: Pelles-C and CURL
« Reply #6 on: February 18, 2019, 12:27:46 AM »
I wasn't aware that Curl was already tuned for PellesC!  :o
Anyway I produced a port, 32/64bits, availabe on github.
The sample is compiled with Windows Security Support Provider Interface (SSPI).
Awesome!
How do I install it in Pelles C?

Offline frankie

  • Global Moderator
  • Member
  • *****
  • Posts: 2101
Re: Pelles-C and CURL
« Reply #7 on: February 18, 2019, 11:59:24 AM »
How do I install it in Pelles C?
Go on github clicking this link.
There you can download a zip of the project, or clone it on your computer.
To install it on your system you have to copy lib, dll and header files in the correct directories:
  • Header files:
    Headers are in the directory 'include\Curl'.
    Copy the whole subdirectory 'Curl' under '$(PellesCDir)\Include'
  • 32bits development:
    All 32 bits binaries are under the directory 'X86'.
    • 32 bits libraries:
      Copy all library files '*.lib' from 'X86' to '$(PellesCDir)\Lib\Win'
    • 32bits DLL:
      Copy Dll's from 'X86' to '$(SystemRoot)\SysWOW64' (that normally is "C:\Windows\SysWOW64").
  • 64bits development:
    All 64 bits binaries are under the directory 'X64'.
    • 64 bits libraries:
      Copy all library files '*.lib' from 'X64' to '$(PellesCDir)\Lib\Win64'
    • 64bits DLL:
      Copy Dll's from 'X64' to '$(SystemRoot)\System32' (that normally is "C:\Windows\System32").
  • Executables:
    Depending on your OS/preferences, copy the 32bits executables from 'X86' directory, or the 64bits executables from 'X64' directory.
    Copy them to a directory listed in the system '$(PATH)' if you want have them available from command line.
« Last Edit: February 18, 2019, 12:07:34 PM by frankie »
It is better to be hated for what you are than to be loved for what you are not. - Andre Gide

alderman

  • Guest
Re: Pelles-C and CURL
« Reply #8 on: February 18, 2019, 12:21:20 PM »
How do I install it in Pelles C?
Go on github clicking this link.
There you can download a zip of the project, or clone it on your computer.
To install it on your system you have to copy lib, dll and header files in the correct directories:
  • Header files:
    Headers are in the directory 'include\Curl'.
    Copy the whole subdirectory 'Curl' under '$(PellesCDir)\Include'
  • 32bits development:
    All 32 bits binaries are under the directory 'X86'.
    • 32 bits libraries:
      Copy all library files '*.lib' from 'X86' to '$(PellesCDir)\Lib\Win'
    • 32bits DLL:
      Copy Dll's from 'X86' to '$(SystemRoot)\SysWOW64' (that normally is "C:\Windows\SysWOW64").
  • 64bits development:
    All 64 bits binaries are under the directory 'X64'.
    • 64 bits libraries:
      Copy all library files '*.lib' from 'X64' to '$(PellesCDir)\Lib\Win64'
    • 64bits DLL:
      Copy Dll's from 'X64' to '$(SystemRoot)\System32' (that normally is "C:\Windows\System32").
  • Executables:
    Depending on your OS/preferences, copy the 32bits executables from 'X86' directory, or the 64bits executables from 'X64' directory.
    Copy them to a directory listed in the system '$(PATH)' if you want have them available from command line.
THANKS!!
You saved hours of my time!

Offline WiiLF23

  • Member
  • *
  • Posts: 72
Re: Pelles-C and CURL
« Reply #9 on: December 29, 2023, 11:40:16 PM »
Working perfectly. Libs where they should go (architecture), and the DLL along with the application (same directory, no system32).

libcurl/7.64.0 Schannel

Thanks!

Offline Vortex

  • Member
  • *
  • Posts: 814
    • http://www.vortex.masmcode.com
Re: Pelles-C and CURL
« Reply #10 on: December 30, 2023, 10:55:13 AM »
curl shipped by Microsoft :

Quote
On December 19 2017, Microsoft announced that since insider build 17063 of Windows 10, curl is a default component.

Windows 10/11 bundle curl
All installs of Microsoft Windows 10 and Windows 11 get curl installed by default since then.

The Microsoft provided version is built to use the Schannel TLS backend. Invoking curl -V after the November 22 2023 update shows this on these platforms:

curl 8.4.0 (Windows) libcurl/8.4.0 Schannel WinIDN
Release-Date: 2023-10-11
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS HSTS HTTPS-proxy IDN IPv6 Kerberos Largefile NTLM SPNEGO SSL SSPI threadsafe Unicode UnixSockets

https://curl.se/windows/microsoft.html
Code it... That's all...

Offline MrBcx

  • Global Moderator
  • Member
  • *****
  • Posts: 177
    • Bcx Basic to C/C++ Translator
Re: Pelles-C and CURL
« Reply #11 on: December 30, 2023, 03:08:06 PM »
Below is from a normal Windows 10 command prompt.
This seems easy enough to be invoked from batch files and shelled processes:

C:\Temp>curl --help

Usage: curl [options...] <url>
 -d, --data <data>          HTTP POST data
 -f, --fail                 Fail fast with no output on HTTP errors
 -h, --help <category>      Get help for commands
 -i, --include              Include protocol response headers in the output
 -o, --output <file>        Write to file instead of stdout
 -O, --remote-name          Write output to a file named as the remote file
 -s, --silent               Silent mode
 -T, --upload-file <file>   Transfer local FILE to destination
 -u, --user <user:password> Server user and password
 -A, --user-agent <name>    Send User-Agent <name> to server
 -v, --verbose              Make the operation more talkative
 -V, --version              Show version number and quit

This is not the full help, this menu is stripped into categories.
Use "--help category" to get an overview of all categories.
For all options use the manual or "--help all".

Bcx Basic to C/C++ Translator
https://www.BcxBasicCoders.com

Offline Vortex

  • Member
  • *
  • Posts: 814
    • http://www.vortex.masmcode.com
Re: Pelles-C and CURL
« Reply #12 on: December 30, 2023, 09:31:19 PM »
Code it... That's all...

Offline John Z

  • Member
  • *
  • Posts: 807
Re: Pelles-C and CURL
« Reply #13 on: December 31, 2023, 07:27:28 AM »
Maybe we will get EDT for windows next  ;D

John Z

Offline WiiLF23

  • Member
  • *
  • Posts: 72
Re: Pelles-C and CURL
« Reply #14 on: January 06, 2024, 08:08:06 PM »
I'm using this library extensively. It has allowed me to use my API endpoints back and forth with no MySQL driver! This is amazing and works perfectly. Its used for synchronizing local files with a remote database and uses a writeback function to write the JSON response back to application and loads data from there after remote database updating.

So PHP and C was required for this, which was easy for me (PHP - 21 years exp).

Thanks a lot!

Just a note, so using WININET is much faster than cURL for some procedures in my code, and that is a slight drawback so some parts are cURL-ready while others are cURL-required. I hope to move everything over to cURL but I first need to find out where the delay overhead is taking place.

Get the version of the library:

Code: [Select]
void ShowCurlVersion(HWND hwndDlg) {
    CURLcode res;
    const char* version = curl_version();

    int len = MultiByteToWideChar(CP_UTF8, 0, version, -1, NULL, 0);
    wchar_t* wVersion = (wchar_t*)malloc((len + 1) * sizeof(wchar_t));
    MultiByteToWideChar(CP_UTF8, 0, version, -1, wVersion, len);

    MessageBoxW(hwndDlg, wVersion, L"cURL Version", MB_OK);
    free(wVersion);
}
Code: [Select]
CURLcode initRes = curl_global_init(CURL_GLOBAL_DEFAULT);
if (initRes != CURLE_OK) {
    MessageBoxW(NULL, L"cURL initialization failed!", L"Error", MB_OK | MB_ICONERROR);
}

ShowCurlVersion(NULL);
curl_global_cleanup();

Im still learning the string formats - wide/narrow so ease up on me lol
« Last Edit: January 06, 2024, 08:11:41 PM by WiiLF23 »