On 06-02-2013 03:58, Alex Peshkoff wrote:
> On 02/05/13 21:26, Leyne, Sean wrote:
>>
>>>> With my 18+ years of using IB/FB I never ran into this issue, never
>>>> had to use a UDF with more than 5 params, so I was surprised by the error.
>>>>
>>>> Is there a 'real' reason why there is a parameter limit?  Or, is it a
>>>> case that a limit was required for syntax purposes and someone thought
>>>> that 10 was a good number?
>>>>
>>> The implementation requires a limit, and the limit is 10.
>>>
>>> Space are allocated in the stack for all parameters, and also passed all 
>>> (even
>>> the unused ones, but is ok for cdecl) parameters to the UDF.
>> But could the limit be increased, if an appropriate argument could be made?
>>
>>
> 
> Sean, currently code, calling UDF, looks this way
> 
> template <typename T>
> T CALL_UDF(Jrd::Attachment* att, int (*entrypoint)(), UDF_ARG* args)
> {
>      Jrd::Attachment::Checkout attCout(att, FB_FUNCTION);
>      return ((T (*)(UDF_ARG, UDF_ARG, UDF_ARG, UDF_ARG, UDF_ARG, 
> UDF_ARG, UDF_ARG, UDF_ARG, UDF_ARG, UDF_ARG))(entrypoint))
>              (args[0], args[1], args[2], args[3], args[4], args[5], 
> args[6], args[7], args[8], args[9]);
> }
> 
> Certainly, it's possible to add args[10], args[11], etc. but this does 
> not look like good solution.
> May be in a private build for you?
> 

The current solution is already ugly, so I don't think adding some (not
too many) more would be bad.

A nice (but complex) solution would involve dynamic code generation
(possibly using a library).


Adriano

------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to