Hi, On Wed, Jul 10, 2002 at 04:27:51PM +0800, zhu wrote: > I want to try a new backend which main file is m1200.c. Other > files are m1200.h,m1200.conf,mscan.c and mscan.h.
Just a note: If you plan to include your backend into SANE later, please change the names of at least the latter two files to e.g. m1200-scan.* so it's easier to find out to which backend they belong. > I did as followed: > (1)Modified the backend/Makefile.in, added "m1200" in the list > following "PRELOADABLE_BACKENDS = " ; That will compile m1200.c. > (2)Added "m1200.c m1200.conf m1200.h mscan.c mscan.h" in the list > following "DISTFILES = " ; If you run "make dist", your backend will be added to sane-backends-*.tar.gz. That's not needed for compilation. > (3)Added "libsane-m1200.la: > ../sanei/sanei_config2.lo","libsane-m1200.la: > ../sanei/sanei_constrain_value.lo" That's ok, if you need these two objects in your backend. > (4)modified the "dll.conf",added "m1200" > (5)make uninstall > (6)execute sane-backends-1.0.8/configure > (7)make (no error) > (8)make install (no error) So compilation is ok, but... > My problem is ,when I type "scanimage -L",it says error ,error info is: > > scanimage:error while loading the shared libraries: > /usr/local/lib/sane/libsane-m1200.so.1:undefined symbol: funcname runtime-linking failed. It's easier to find such errors if you use "configure --disable-shared" (use static linking). > This "funcname" is a function declared in file mscan.h and > defined in mscan.c,and called in the function "sane_init". In the > file m1200.c ,I've not forgotten include the head file "mscan.h". mscan.c is never compiled. The Makefile doesn't know about it. You told the compiler: Hey, I have an external function "funcname" and I will link the object file that includes the functions code. But you didn't :-) Two solutions: 1) Include mscan.c in m1200.c. Either by copying the code into that file or by using #include. Not that nice but the easiest solution. 2) Link the two files together. Have a look at canon_pp in the Makefile.in for an example, how to do it. Keep in mind, that you shouldn't export functions, that don't start with "sane_*" (the API-functions) or "sanei_*". And the symbols should be unique. So if you use approach 2), you should name the xported functions from mscan.c sumething like sanei_m1200_*. When your backend works (at least to some degeree), we are interested in which scanners it will support and where we can download it. We are even more interested in a .desc file :-) Bye, Henning
