Subject Re: [ib-support] FBUDF troubles
Author Claudio Valderrama C.
""rhollay"" <zoltan.korponai@...> wrote in message
news:9v9hh9+i1s5@......
> 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