[sane-devel] backend naming conventions/constraints
Olaf Meeuwissen
olaf at epkowa.co.jp
Sat Mar 1 01:13:06 GMT 2003
Henning Meier-Geinitz <henning at meier-geinitz.de> writes:
> On Fri, Feb 28, 2003 at 08:50:44PM +0900, Olaf Meeuwissen wrote:
> > I tried getting things to work with a hyphenated backend name, but to
> > no avail. The dll backend uses the literal name in dll.conf to check
> > for functions in the backend :-(
>
> What would be the alternative? How should it get the internal
> backend name?
Replace any character that is not valid in a C identifier with `_'?
The Makefile.in's could use the same convention and use
-DBACKEND_NAME=$(shell echo $* | sed 's,[^_a-zA-Z0-9],_,g')
The BACKEND_NAME is prefixed with sane_, so you don't need to worry
about backend names that start with a digit.
> > Some minor mods in the dll backend could easily fix that (I'd think),
> > but since I have to rely on existing sane-backends packages out there
> > that is not an option for me right now. I'll go with epkowa for the
> > backend.
>
> Sounds fine for me.
Eh, that is I'll go with "epkowa" modulo objections from higher up the
foodchain (management and the like).
> Keep in mind that attaching to a sane backend is quite flexible.
> That's the reason for some of the tricks used in the Makefile.
>
> 1) static linking
> a) link to one backend statically (e.g. net). The symbold must be
> sane_init () (without backend name) for this to work.
> b) link to libsane-dll.a which includes (preloads) all backends
> statically. The api symbols must use e.g. sane_mustek_init () to
> avoid duplicated symbols.
> 2) shared libraries
> a) link to any sane backend as shared library. The symbol names must
> be sane_init(). The so name of the library must be libsane.so
> (not libsane-mustek.so), otherwise you can't change the backend
> after linking. That's the reason for the change in libtool.
> b) link to libsane-dll.so as a shared libryry which preloads all
> other backends (see above).
> 3) dynamic loading
> link to libsane-dll.so which loads all other backends dynamically.
>
> I'm open for changes but it's not as easy as it looks on first sight.
I've only changed the way a file name is mapped to a BACKEND_NAME, so
I would say it's okay. But then again, I am not familiar with all the
little hacks to get the above to work ;-)
As far as I can see, only the dll backend needs to do the same.
--
Olaf Meeuwissen EPSON KOWA Corporation, ECS
GnuPG key: 6BE37D90/AB6B 0D1F 99E7 1BF5 EB97 976A 16C7 F27D 6BE3 7D90
Penguin's lib! -- I hack, therefore I am -- LPIC-2
More information about the sane-devel
mailing list