Subject Re: FBUDF troubles
Author rhollay
Hi, Claudio

Good news!

I don't have to sell my dog!

It was the FBUDF.dll itself. I've downloaded it from your site,
simply copied it to the UDF directory and now it works.
Yes, it may be some strange bug in the FB (IB) engine affecting
UDFs. When I tried the new functions, I got some odd results.
For example: iNvl(AIntegerField,0) always returned 32 regardless of
the second parameter, and for sNvl(ACharField,'NULL') I always got
a space instead of a 'NULL' string. It's interesting: the SPACE
character has an ASCII code of 32!
I followed your instructions, stopped the FB engine, started again,
reinstalled the UDFs, stopped, started ... but the results were the
same. I gave it up.
But today morning I turned on my local workstation (the server was
running all the night), tried again the concerned functions, and the
results were CORRECT! Maybe it's sufficient to restart the local
workstations after installing the UDFs on the server (just a guess!).

Thank you, Zoli


--- In ib-support@y..., "Claudio Valderrama C." <cvalde@u...> wrote:
> ""rhollay"" <zoltan.korponai@s...> wrote in message
> news:9v9hh9+i1s5@e...
> > Hi,
> >
> > I have troubles with FBUDF.dll. This problem is several times
> > discussed in this newsgroup already, but nobody gave an adequate
> > answer yet.
>
> There's nothing special in FBUDF as a DLL. The only requirement is
that the
> engine should be Firebird, not IB. IB doesn't understand the SQL
script that
> declares the functions. Even if you tweak system tables, the most
probably
> income is that IB will crash because it doesn't know to handle the
return
> argument by descriptor and it doesn't know how to handle the return
argument
> being timestamp. But I see you are using FB already.
>
> Try this URL:
> www.cvalde.com/utilities/fbudf.zip
>
> I found that in every release of IB (so FB may be affected as well)
some
> random UDF declaration didn't work at all. My only solution was to
drop the
> declaration, shut down IB, start it, declare the UDF and restart IB
again.
> It happened to me with FreeUDFLib's original functions in IB4.2. It
happened
> to me in IB6 beta, with the new function that I injected in
FreeUDFLib,
> available with some fixes from
> www.cvalde.com/utilities/freeUDFLib.zip
> I couldn't convince the engine that the function was there! I even
queried
> the operating system but there was no previous version loaded, etc.
Since I
> shut down the machine at the end of my daily (or nightly) work,
next day I
> found that the function worked.
>
> I think that there's some strange bug in the code that handles UDF
homonyms
> inside the engine, when the UDF to be called should be decided
based on an
> algorithm that might resemble how C++ picks the best overloaded
function.
> Maybe it finds the only available homonym and decides that it's not
the
> correct one, just a guess. But I looked at the code in the past and
found
> nothing suspicious. (Yes, the core engine is prepared for some kind
of UDF
> overloading, but it can't happen currently due to restrictions in
system
> tables, so you can't have two UDFs with the same name.)
>
> Therefore, I don't have a suggestion other than try the zip from
the above
> link and if it doesn't work, get a new computer, a new house and a
new
> dog... my cat insists that dogs are the source of several problems.
> :-)
>
> C.
> --
> Claudio Valderrama C. - http://www.cvalde.com -
http://www.firebirdSql.org
> Independent developer
> Owner of the Interbase® WebRing