Skip to content
Mercury13 edited this page Nov 1, 2017 · 12 revisions

Units to use

uses Curl.Lib;

From C to Pascal: types

For handles (pointers to unknown structs): CURL*HCurl and so on. H = handle.

For callbacks: curl_lock_functionEvCurlLock and so on. Ev = event.

For other types: CURLcodeTCurlCode, curl_httppost *PCurlHttpPost and so on.

Of course, there is no C FILE* in Pascal. Functions that use this pointer are present but unusable.

From C to Pascal: functions

Straightforward, with three exceptions.

  1. curl_easy_setopt is type-safe. For raw unsafe function see curl_easy_setopt_initial.

  2. curl_formadd has 10 versions with different number of parameters. All parameters are PAnsiChar, to simplify passing strings. If you want integer or pointer, just cast PAnsiChar(x). For raw unsafe function see curl_formadd_initial, but it is EXTREMELY mistake-prone, I warned you!

Sorry, but to use new >2G files in x86, you need to use that initial mistake-prone function. Arrays do not support them, and I don’t know how to write something type-safe.

  1. curl_easy_getinfo is type-safe. For raw unsafe function see curl_easy_getinfo_initial.

Utility functions

ProxyFromIe is a function that gets HTTP proxy from Internet Explorer.

Clone this wiki locally