Fixing curlpas so it would compile and install in latest Lazarus/FreePascal

What is curlpas? (Taken from the official web)

CurlPas is a Delphi / Kylix / FreePascal binding and component wrapper for libcurl .

Curlpas had so many features that other internet LCL didn’t have. Such as: multi-platform, non-blocking, proxy support, SSL support, byte ranges, multiple asynchronous transfers. The most exiting part for me is that curlpas make it easier for me to understand internet/network programming (I use curl a lot in my PHP projects).

The problem is that curlpas is so old (dated 2005) and haven’t updated to reflect latest change in Lazarus IDE and FPC. So, when you try to compile it, you’ll get a lot of error messages mostly about PChar, AnsiString, WideString and Pointer. (I forgot the exact error messages).

In order to fix those errors, you have to:

  • edit file curl_h.pas line #29, from this
LIB_CURL = {$IFDEF LINUX} '' {$ELSE} 'libcurl-3.dll' {$ENDIF};

into this

LIB_CURL = {$IFDEF LINUX} '' {$ELSE} 'libcurl.dll' {$ENDIF};
  • edit file line #6 until #9 from this

into this (notice that I only move the H+ directive)

  • edit file on line #30 from
SetResultCode(curl_easy_setopt(fCurl, CURLOPT_PROGRESSDATA, Self), CURLOPT_PROGRESSDATA);

into this:

SetResultCode(curl_easy_setopt(fCurl, CURLOPT_PROGRESSDATA, pointer(Self)), CURLOPT_PROGRESSDATA);
  • and still in but on line #93 from
SetResultCode(curl_easy_setopt(fCurl, CURLOPT_DEBUGDATA, Self), CURLOPT_DEBUGDATA);

into this:

SetResultCode(curl_easy_setopt(fCurl, CURLOPT_DEBUGDATA, pointer(Self)), CURLOPT_DEBUGDATA);
  • and the last one to edit is line #125, from:
SetResultCode(curl_easy_setopt(fCurl, CURLOPT_PRIVATE, self), CURLOPT_PRIVATE);

into this:

SetResultCode(curl_easy_setopt(fCurl, CURLOPT_PRIVATE, pointer(self)), CURLOPT_PRIVATE);
  • save all, compile and install on your Lazarus IDE, cURL should be shown in Lazarus component palette named “Internet”

above steps had been tested on Lazarus 1.1, FPC 2.7.1 on Ubuntu Linux 12.04 and Windows 7

  1. mickeyspotty

    Hi, I get the following error…

    lazcurl.pas(0,0) Fatal: Can not find unit LResources used by lazcurl. Check if package LCLBase is in the dependencies.

  2. Thank you. it works.

  3. Adding LCLBase Packade to dependencies and is ok 🙂

  4. Thankyou so much!
    It works!

  5. Adding LCLBase finx some of the problems to compile but also akss for libc library which is deprecated.
    Please, help

  6. Hi, it work on windows and linux 32bit.
    But it not work on linux 64bit
    You tested it on Ubuntu Linux 12.04, is it 32bit version?

  7. Thanks man! Love you for this!

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>