Subject UDFs & Firebird 1.0.1
Author Niall Scott
Hi



Is there a problem with Firebird v1.0.1 and UDFs I use a few of the Date
related functions in FreeUDFLib occasionally and I just noticed that
they aren't working.

In IB Console all the functions I use give

Initialisation failure

unsupported data type.



I built a new DLL with two functions in it as below , taken from Greg
Deatz's 'Writing UDFs for Interbase under Windows and Linux'



uses ib_util,ibase,ib_externals;

function Left(sz: Pchar; cnt: Integer): Pchar; cdecl; export;

function Year(ib_date: PISC_QUAD): integer; cdecl; export;

implementation



function Left(sz: Pchar; cnt: Integer): Pchar;

var

i: Integer;

begin

if (sz = nil) then

Result := nil

else begin

i := 0;

while (sz[i] <> #0) do

inc(i);

Result := ib_util_malloc(i);

Move(sz[0], Result[0], i);

end;

end;



function Year(ib_date: PISC_QUAD): integer;

var

tm_date: TCTimeStructure;

begin

isc_decode_date(ib_date, @tm_date);

Result := tm_date.tm_year + 1900;

end;

end.



And initialised them with



Declare external function g_Left

Cstring(64), integer

Returns cstring(64) free_it

Entry_point 'Left' module_name 'testdll.dll';



Declare external function g_Year

Date

Returns integer

Entry_point 'Year' module_name 'testdll.dll';





Firebird is happy with g_left but G_year has the same problem.



Any help would be greatly appreciated as I need these functions to run
my Year End routines



T.I.A.



Niall R Scott

IS Support

Cameron Controls

Aberdeen

<mailto:scottn@...> scottn@...



****************************************************
This e-mail is confidential, may contain proprietary information of the
Cooper Cameron Corporation and its operating Divisions and may be
legally privileged.
This e-mail should be read, copied and/or used only by the addressee. If
you have received this message in error please delete it, together with
any attachment(s), from your system.
****************************************************





[Non-text portions of this message have been removed]