cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: help on libcurl (Win32 - Generic) with Borland C++ Builder

From: Cheng-Lin Yang <yuwen_at_exodus.cs.ccu.edu.tw>
Date: Thu, 19 Jul 2007 02:48:29 +0800 (CST)

Hi Andre,
I finally tried out the solution. I post a successfully work source code
in my blog. Hope this can help others who use C++ Builder with libcurl.

Example code:
http://exodus.cs.ccu.edu.tw/~yuwen/NUBlog/

Regards,
Cheng-Lin Yang
-----Original message-----
From:Andre Guibert de Bruet <andy_at_siliconlandmark.com>
To:yuwen_at_exodus.cs.ccu.edu.tw
Cc:libcurl development <curl-library_at_cool.haxx.se>
Date:Wed, 18 Jul 2007 09:00:30 -0400
Subject:Re: help on libcurl (Win32 - Generic) with Borland C++ Builder

On Jul 18, 2007, at 8:55 AM, Andre Guibert de Bruet wrote:
> On Jul 18, 2007, at 7:38 AM, Cheng-Lin Yang wrote:
>> But I don't know how to use the function in liburl-4.dll.(I know
>> I should use GerProcAddress to do so, but is there any example?)
>> Can someone here help me on this? Thanks. :)
>>
>> My code:
>> if( ( cl = LoadLibrary( "c:\\libcurl-4.dll" ) ) == NULL ){
>> MessageBox(NULL, "I can't load libcurl","DingDing", 0);
>> return;
>> }
>>
>> I_dont_know_how_to_get = GetProcAddress(cl, "curl_easy_init" );
>
> I strongly suggest you use the import library and not deal with the
> mess of assigning the right function pointer for each curl easy
> function. Just in case you decide not to, here is an example I have
> put together from an unrelated project (Names have been sanitized,
> of course ;-) ):
>
> typedef char *(*FNGETSTRING)(int);
>
> void dosomethinguseful()
> {
> char *blah;
> FNGETSTRING foo;
>
> ...
>
> foo = (FNGETSTRING) GetProcAddress(hDLL /* From LoadLibrary */,
> "foo");
> blah = foo(1); /* you are calling the GetProcAddress'ed function */
>
> ...
> }

In my example, I have not checked the return value of GetProcAddress
for clarity. The official MSDN documentation shows how to do this:
http://msdn2.microsoft.com/en-us/library/64tkc9y5(vs.71).aspx

Cheers,

/* Andre Guibert de Bruet * 436f 6465 2070 6f65 742e 2042 6974 206a */
/* Code poet / Sysadmin * 6f63 6b65 792e 2053 7973 4164 6d69 6e2e */
/* GSM: +1 734 846 8758 * 2055 4e49 5820 736c 6575 7468 2e00 0000 */
/* WWW: siliconlandmark.com * C/C++, Java, Perl, PHP, SQL, XHTML, XML */
Received on 2007-07-18