cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Max number of args to curl_formadd()

From: Yet Another Geek <yetanothergeek_at_yahoo.com>
Date: Sat, 23 Nov 2002 16:33:47 -0800 (PST)

Hello, Daniel...
Thanks for your speedy reply.

> > Still trying to get the curl_formadd() function
> > implemented across FreePascal/Delphi/Kylix.

> > So the question is, just how many possible
> > flag/value pairs can there be?

> I'd suggest that you make it cover common amounts of
> arguments, and then if users find problems with
> this, you add more combinations later on.

Will do, sir.

> Or just fix FreePascal.
> It's an insanely stupid limitation! ;-)

Actually, FreePascal has no such limitation, it is
just that the calling convention is different than
Borland.

Any number of arguments can be passed to the library
from FreePascal, but they must be enclosed in a pascal
array:

curl_formadd( @firstpost, @lastpost,
[ opt_one, val_one, opt_two, val_two, CURLFORM_END ]
)

That is clean and simple enough (and it works) but it
makes the cross-compiler code look a bit strange:

curl_formadd( @firstpost, @lastpost,
  {$IFDEF FPC} [ {$ENDIF}
  opt_one, val_one, opt_two, val_two, CURLFORM_END
  {$IFDEF FPC} ] {$ENDIF}
)

I also have another option, to wrap the kylix/delphi
version in a function that takes the "array of const"
parameter,uses a switch-case on the size of the array,
and splits the elements into a "varargs" call.

That way I just have one BIG UGLY instead of a
bunch of little uglies. ;-)

 - Jeff

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
Received on 2002-11-24