Subject Re: Embedded Database connect -904, "unavailable database?
Author Adam
--- In firebird-support@yahoogroups.com, Richard Wesley <hawkfish@...>
wrote:
>
>
> On May 14, 2006, at 16:24, Adam wrote:
>
> > This has nothing to do with Firebird. Firebird doesn't care what it
> > is called, call it fred.dll and it will still work.
>
> A small caveat: Firebird by itself may not care, but various UDF
> files DO care and will refuse to load if the main dll name is not
> what it expects. Use depends to figure out what is what.

Hi Richard,

Are we talking about the same thing?

UDF / External functions are calls from within the Firebird engine to
dlls usually to add functionality to the engine (eg, absolute value)

To use a UDF, that udf must be declared in a database. This
declaration looks something like this:

DECLARE EXTERNAL FUNCTION abs
DOUBLE PRECISION
RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'IB_UDF_abs' MODULE_NAME 'ib_udf';

You will note that part of the declaration is the MODULE_NAME, which
tells Firebird which dll the entry point is in. If ib_udf.dll waas
renamed to wilma.dll, then the external function would need to be
declared as:

DECLARE EXTERNAL FUNCTION abs
DOUBLE PRECISION
RETURNS DOUBLE PRECISION BY VALUE
ENTRY_POINT 'IB_UDF_abs' MODULE_NAME 'wilma';

Obviously, your UDF dll will need to be named according to what the
declaration says (or vice versa).

The client library itself sits between your application and the
Firebird engine. It takes care of the TCP stuff that must go on
between client and server, as well as other things beyond my
knowledge. With the embedded server, that same dll also internally
launches an instance of the Firebird superserver engine. The Firebird
superserver engine instance will not all of a sudden refuse to load
because the dll is not called fbclient.dll.

However when your applications plug into the client library, the
connection components may be expecting it to be called fbclient.dll or
gds32.dll. Some connection components allow you to dynamically set the
client library name, which is good because you could simply use an ini
file switch to choose which library you wish to use. Of course,
passing the embedded engine a TCP connection string will make it act
the same as a standard client, so it is a best of both worlds scenario.

Adam