[sane-devel] HP5400 backend progress

Henning Meier-Geinitz henning@meier-geinitz.de
Mon, 24 Feb 2003 15:32:57 +0100


Hi,

On Tue, Feb 25, 2003 at 12:33:53AM +1100, Martijn van Oosterhout wrote:
> On Sun, Feb 23, 2003 at 11:54:47PM +0100, Henning Meier-Geinitz wrote:
> > Further more, despite the library name sane-hp5400.so, the internal so
> > name must be libsane.so, otherwise linking won't work. We use a
> > modified libtool for this trick.
> 
> Ok, I see the problems. I looked hoping to find a Makefile fragment I can
> include but it seems I need to modify the sane Makefile.in and run configure
> again. Not quite as stright forward as I hoped. Is there a better way?

Either distribute your backend as part of a stripped-down
sane-backends installation (e.g. all other backends and frontends
removed) or as a .tar.gz includeing all changes that are necessary
(your backend + Makefiles + dll.c, ...) or as a patch.

You can write your own backend without sane-backends, but you must
take care for everything yourself. E.g. portability to other
platforms. See libs/ and include/sanei/sane_backend.h for some of the
tricks used.

> Oddly enough it's sane-debug.h that renaming all my functions in the
> library. Very odd.

The renaming is done in sanei_hackend.h. sanei_debug.h only provides
the ENTRY() macro. I don't think it really belongs there, but I guess
that's because it need the name of the backend like the other debug
functions.

Look at the backend/ directory. There are files that end in -s.c.
Those are the wrappers to get the sane_ functions without the backend
name again. If you link statically, you don't link them and get
sane_backendname_init. If you link as shared lib, you also link to
*-s.o and get sane_backendname_init and sane_init.

It's much easier to just use the magic thean to fully understand it.
Believe me, I don't think I completely understand it after five years
:-)

Bye,
  Henning