Subject Re: [firebird-support] UDF assistance
Author Ivan Prenosil
> Declaration:
> ============
>
> DECLARE EXTERNAL FUNCTION FB_ADDMINS
> TIMESTAMP,INTEGER
> RETURNS TIMESTAMP FREE_IT
> ENTRY_POINT 'FB_AddMins' MODULE_NAME 'MyUDF';
>

> UDF Code (Delphi 7):
> ==================
> {Export Functions}
>
> function FB_AddMins(var DT: ISC_TIMESTAMP; var Minutes: Integer):
> PISC_TIMESTAMP; cdecl;
> var
> DTConverted: TDateTime;
> begin
> OutputDebugString('FB_AddMins Start');
> DTConverted := TimeStampToDateTime(DT);
> DTConverted := DTConverted + Minutes/1440;
> DT := DateTimeToTimeStamp(DTConverted);
> Result := @DT;
> OutputDebugString('FB_AddMins End');
> end;


Memory for the result must be allocated using:

function ib_util_malloc(size: LongWord): Pointer; external 'ib_util.dll';

Ivan