curl-library
Re: help on libcurl (Win32 - Generic) with Borland C++ Builder
Date: Wed, 18 Jul 2007 08:55:03 -0400
On Jul 18, 2007, at 7:38 AM, Cheng-Lin Yang wrote:
> Dear all,
> I tried to google for the answer, but failed. So I come to here
> for help. I'm now using libcurl 7.16.4 (without SSL) Win32 - Generic
> version with Borland C++ Builder 2006. I used LoadLibrary to load
> the dll file which is extracted from libcurl-7.16.4-win32-nossl.zip.
> 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 */
...
}
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