Subject Re: [firebird-support] Need help writing a UDF...
Author Ivan Prenosil
>>>function Distance(var lon1, lon2, lat1, lat2: real): real; cdecl;
>>
>> Kill 'var'. You've declared the UDF as receiving arguments by
>> value, not by reference.
>
> I think 'var' is correct, input parameters are always passed by reference.

But perhaps in some future Firebird versions NULL value
will be passed as null pointer, so better use

function Distance(lon1, lon2, lat1, lat2: PDouble): Double; cdecl;
...
if Assigned(lon1) then ...

Ivan