Subject Re: embedded firebird and UDFs
Author robert_hollay
Hi,

I'm afraid, this is a good old issue with FB (IB) and UDFs.
Dec. 2001, when I got the following answer from
Claudio Valderrama (the author of the FBUDF):


---- quotation

>> 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 Interbaser WebRing
>

---- end of quotation



--- In firebird-support@yahoogroups.com, "Gustavo D. B."
<gustavo_000@o...> wrote:
> Hi...
>
> I've detected and I've told the forum in a previous post that I
had the same
> kind of error when trying to make UDFs work in FB under W98...
>
> I've used that time the RC2 and now I'm using the RC3 and the
problem is
> still there... The problem is the same that you are describing...
I've tryed
> a SuperServer Installation...
>
> I had the exact same instalation structure and configurations
(even the same
> scripts to generate dummy DBs, etc, etc) under W2K and under
W98... W2K
> worked fine, W98 didn't... So, because I thought I was doing
something
> wrong, I un-installed FB and installed IB 6.01 in both machines
with the
> same structure/configuration... In this new case, all worked
fine...
>
> I think that's something with FB, but of course, I'm not an
expert... ;)
>
> Thanks...
>
> Gustavo.