[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: backend functions declaration



> Hallvard B Furuseth wrote:
>
>>Pierangelo Masarati writes:
>>
>>
>>>As a consequence of looking at ITS#3387, I note that many backends
>>> declare
>>>the function handlers (usually in a dedicated external.h header).  This
>>> is
>>>not required, since all the frontend needs to know (for statically
>>>compiled backends) is the <backend>_initialize() function; runtime
>>> loaded
>>>backends don't even need it.  An exception are those backends that have
>>>cross-dependencies (e.g. back-ldap and back-meta, back-bdb and
>>> back-hdb).
>>>
>>>I'd like to remove all of this, to avoid confusion and maintenance
>>> overhead.
>>>
>>>
>>
>>Sounds good.  Just make sure that the .h file(s) which declare the
>>*_initialize() which backend.c uses, are also read by the backend .c
>>files that define the *_initialize() functions.
>>
>>
> I must have misunderstood the first message. If we're just talking about
> eliminating "external.h" because the frontend doesn't need it and the
> backend declares its functions in a separate file already (such as
> proto-bdb.h) then yes, I agree.

Exactly.  The proto-<backend>.h is logically local to the backend; the
external.h needs only know the <backend>_initialize() function.  If a
backend were so compact to fit into a single file, all the functions could
be declared static.

Elaborating from Hallvard's idea, I think we could safely speculate on the
backend's availability of a function <backend>_initialize() (this could be
a coding style requirement) and define/use it locally even without
including any backend-specific header.  Then, the function's name and so
could be built from a macro.  But this is secondary, as it may obfuscate
the code.

p.

-- 
Pierangelo Masarati
mailto:pierangelo.masarati@sys-net.it


    SysNet - via Dossi,8 27100 Pavia Tel: +390382573859 Fax: +390382476497