[sane-devel] C#/Mono FrontEnd Wrapper for scanimage / scanadf

Christopher Sawyer christoofar at gmail.com
Mon Apr 5 02:12:04 UTC 2010


(copy to list)

Yes the STDIN/STDOUT is pretty kludgy way of interfacing to SANE, but it was
quick and dirty.   Now that I have the core objects written like I want
them, I can now go back and figure out how to glue it up using a direct
binding.

Actually I think what most Mono programmers do is write a C binding system
object lib that uses simple data types and then write a .NET object which
uses [DllImport] P/Invoke directive on the methods to redirect the calls on
the object to the library.


What I need to do now is read the scanimage source code and understand how
it works so I can understand the headers and write the .NET proxy class and
the lib glue code (no small task!) :-)

On Sun, Apr 4, 2010 at 9:16 PM, Alejandro Imass <ait at p2ee.org> wrote:

> On Sun, Apr 4, 2010 at 12:55 PM, Christopher Sawyer
> <christoofar at gmail.com> wrote:
> > Hello
> >
> > I had been looking for a long time for a Mono binding for SANE but most
> of
> > my efforts have been fruitless (probably because none exist! :-)  so I
> > started writing my own.
> >
> > If anybody wants to help me, I put the source here:
> > http://code.google.com/p/mono-sane/
> >
> > The code is capable of reading the scanner list from scanimage,
> interpreting
> > the configuration options, performing a one-pass scan with or without
> > scanimage options.
> >
> > It shells out to scanimage and collects its output from there.  I'm
> > expanding it as I go along since I'm using it to experiment with forms
> > recognition.  I'm working on ADF, thread-safety, delegate callbacks for
> > asynchronous scanning right now and hope to finish it soon.
> >
>
> Dunno much about Mono but you should be using the SANE API directly.
> It has of course native binding to C, but surely there must be a way
> of loading shared objects and static C libraries from Mono/C#. For
> example in Perl it's called XS, a language/API that helps glue C code
> to Perl, there surely must be something for C#., I think you should be
> looking into that, rather than a STDIN/STDOUT interface with
> scanimage. Just did a quick google search came up with this:
>
> http://www.mono-project.com/Interop_with_Native_Libraries
>
> Cheers,
> Alejandro Imass
>
> > --
> > sane-devel mailing list: sane-devel at lists.alioth.debian.org
> > http://lists.alioth.debian.org/mailman/listinfo/sane-devel
> > Unsubscribe: Send mail with subject "unsubscribe your_password"
> >             to sane-devel-request at lists.alioth.debian.org
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.alioth.debian.org/pipermail/sane-devel/attachments/20100404/6cb47c3b/attachment.htm>


More information about the sane-devel mailing list