sane-project-website/old-archive/2000-06/0236.html

217 wiersze
5.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML>
<HEAD>
<TITLE>sane-devel: Sane API problem: multiple sane_init calls</TITLE>
<META NAME="Author" CONTENT="mh (moloch@nikocity.de)">
<META NAME="Subject" CONTENT="Sane API problem: multiple sane_init calls">
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Sane API problem: multiple sane_init calls</H1>
<!-- received="Fri Jun 30 13:39:38 2000" -->
<!-- isoreceived="20000630203938" -->
<!-- sent="Fri, 30 Jun 2000 21:33:41 +0200" -->
<!-- isosent="20000630193341" -->
<!-- name="mh" -->
<!-- email="moloch@nikocity.de" -->
<!-- subject="Sane API problem: multiple sane_init calls" -->
<!-- id="00063022443900.13239@slowcrap" -->
<STRONG>From:</STRONG> mh (<A HREF="mailto:moloch@nikocity.de?Subject=Re:%20Sane%20API%20problem:%20multiple%20sane_init%20calls&In-Reply-To=&lt;00063022443900.13239@slowcrap&gt;"><EM>moloch@nikocity.de</EM></A>)<BR>
<STRONG>Date:</STRONG> Fri Jun 30 2000 - 12:33:41 PDT
<P>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0237.html">Jochen Eisinger: "Re: bug in saned"</A>
<UL>
<LI><STRONG>Previous message:</STRONG> <A HREF="0235.html">Chris Pinkham: "Re: TODO for 1.0.3"</A>
<!-- nextthread="start" -->
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#236">[ date ]</A>
<A HREF="index.html#236">[ thread ]</A>
<A HREF="subject.html#236">[ subject ]</A>
<A HREF="author.html#236">[ author ]</A>
</UL>
<HR NOSHADE><P>
<!-- body="start" -->
<P>
Hi,
<BR>
since I'm new to this list, I dare to ask a dump question:
<BR>
I'm trying to make use of the Sane API from within a C++ program to write a
<BR>
little frontend for my scanner.
<BR>
My problem is that I'm unable to make a call to sane_init for more then one
<BR>
time. Whenever I call sane_init a second time my app segfaults.
<BR>
Please have a look at the following code:
<BR>
(and sorry, if this isn't a Sane problem at all)
<BR>
<P>////////////////////////////////////////////////////
<BR>
// tested with SuSE 6.4, Kernel 2.2.14
<BR>
//gcc/g++ 2.95.2
<BR>
//Sane 1.0.2
<BR>
//backend for plustek parallel port scanner version 0.27
<BR>
//dynamically linked
<BR>
//Scanner Plustek OpticPro 600P
<BR>
#include &lt;stdio.h&gt;
<BR>
extern &quot;C&quot;
<BR>
{
<BR>
#include &lt;sane/sane.h&gt;
<BR>
#include &lt;sane/sanei.h&gt;
<BR>
#include &lt;sane/saneopts.h&gt;
<BR>
#include &lt;sane/config.h&gt;
<BR>
}
<BR>
<P>int main(int argc, char *argv[])
<BR>
{
<BR>
&nbsp;&nbsp;const SANE_Device** device_list ;
<BR>
&nbsp;&nbsp;const SANE_Device** device_list2 ;
<BR>
&nbsp;&nbsp;int i;
<BR>
&nbsp;&nbsp;SANE_Status status;
<BR>
&nbsp;&nbsp;status=sane_init(0,0);
<BR>
&nbsp;&nbsp;if(status==SANE_STATUS_GOOD)
<BR>
&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;status=sane_get_devices(&amp;device_list,SANE_FALSE);
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;if(status==SANE_STATUS_GOOD)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (i = 0; device_list[i]; ++i)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(&quot;%s %s\n&quot;,device_list[i]-&gt;vendor,device_list[i]-&gt;model);
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}
<BR>
&nbsp;&nbsp;}
<BR>
&nbsp;&nbsp;sane_exit();
<BR>
&nbsp;&nbsp;status=sane_init(0,0);
<BR>
&nbsp;&nbsp;if(status==SANE_STATUS_GOOD)
<BR>
&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;status=sane_get_devices(&amp;device_list2,SANE_FALSE);
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;if(status==SANE_STATUS_GOOD)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;{
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (i = 0; device_list2[i]; ++i)
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;printf(&quot;%s %s\n&quot;,device_list2[i]-&gt;vendor,device_list2[i]-&gt;model);
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;}
<BR>
&nbsp;&nbsp;}
<BR>
&nbsp;&nbsp;sane_exit();
<BR>
&nbsp;&nbsp;return 0;
<BR>
}
<BR>
<P>The output on the command line:
<BR>
Plustek 600P Vers = 0.0
<BR>
Noname PNM file reader
<BR>
Noname PNM file reader
<BR>
Speicherzugriffsfehler (segfault)
<BR>
<P>Program received signal SIGSEGV, Segmentation fault.
<BR>
0x400effa4 in strcat () at ../sysdeps/generic/strcat.c:51
<BR>
51 ../sysdeps/generic/strcat.c: Datei oder Verzeichnis nicht gefunden.
<BR>
(gdb) bt
<BR>
#0 0x400effa4 in strcat () at ../sysdeps/generic/strcat.c:51
<BR>
#1 0x4002201e in sane_dll_get_devices () at dll.c:472
<BR>
#2 0x40022733 in sane_get_devices () at dll-s.c:35
<BR>
#3 0x80486f2 in main ()
<BR>
#4 0x400b3a5e in __libc_start_main () at ../sysdeps/generic/libc-start.c:93
<BR>
<P>What does the debugger output mean: ..../strcat.c:51 &quot;file or folder not found&quot;?
<BR>
(There's no strcat.c on my system at all)
<BR>
&nbsp;&nbsp;
<BR>
Can someone explain this please?
<BR>
Thanks a lot,
<BR>
Michael
<BR>
<P>BTW Sane is *cool*.
<BR>
Now there's almost no reason left to boot Windoze.
<BR>
<P><PRE>
--
Source code, list archive, and docs: <A HREF="http://www.mostang.com/sane/">http://www.mostang.com/sane/</A>
To unsubscribe: echo unsubscribe sane-devel | mail <A HREF="mailto:majordomo@mostang.com?Subject=Re:%20Sane%20API%20problem:%20multiple%20sane_init%20calls&In-Reply-To=&lt;00063022443900.13239@slowcrap&gt;">majordomo@mostang.com</A>
</PRE>
<P><!-- body="end" -->
<HR NOSHADE>
<UL>
<!-- next="start" -->
<LI><STRONG>Next message:</STRONG> <A HREF="0237.html">Jochen Eisinger: "Re: bug in saned"</A>
<LI><STRONG>Previous message:</STRONG> <A HREF="0235.html">Chris Pinkham: "Re: TODO for 1.0.3"</A>
<!-- nextthread="start" -->
<!-- reply="end" -->
<LI><STRONG>Messages sorted by:</STRONG>
<A HREF="date.html#236">[ date ]</A>
<A HREF="index.html#236">[ thread ]</A>
<A HREF="subject.html#236">[ subject ]</A>
<A HREF="author.html#236">[ author ]</A>
</UL>
<!-- trailer="footer" -->
<HR NOSHADE>
<P>
<SMALL>
<EM>
This archive was generated by <A HREF="http://www.hypermail.org/">hypermail 2b29</A>
: <EM>Fri Jun 30 2000 - 13:40:56 PDT</EM>
</EM>
</SMALL>
</BODY>
</HTML>