[Haskell-cafe] global variables for foreign C functions

John Van Enk vanenkj at gmail.com
Mon Dec 1 21:31:52 EST 2008


I would find a ForeignData extension incredibly helpful. This will be
crucial if Haskell ever wants to target out of the ordinary systems.

/jve


On Mon, Dec 1, 2008 at 8:38 PM, John Meacham <john at repetae.net> wrote:

> On Mon, Dec 01, 2008 at 04:55:14PM -0800, Evan Laforge wrote:
> > On Mon, Dec 1, 2008 at 4:39 PM, Andrea Rossato
> > <mailing_list at istitutocolli.org> wrote:
> > > Hello,
> > >
> > > I'm writing the bindings to a C library which uses, in some functions,
> > > global variables.
> > >
> > > To make it clearer, those functions need a global variable to be
> > > defined. A C program using my_function, one of the library functions,
> > > would look like:
> >
> > I don't think you can use the FFI to declare symbols for C.  One
> > not-so-pretty but effective way to do it is create a stub.c with the
> > variables declared along with setting functions, then bind those
> > functions like any other.
>
> Yes, it is unfortunate this is the case. my ForeignData proposal was
> meant to address this:
>
> http://hackage.haskell.org/trac/haskell-prime/wiki/ForeignData
>
> I am not entirely sure about the proposal as described, but I think
> something like it should be done.
>
>        John
>
> --
> John Meacham - ⑆repetae.net⑆john⑈
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20081201/fff84209/attachment.htm


More information about the Haskell-Cafe mailing list