[Haskell-beginners] Re: ffi woes

Jose A. Ortega Ruiz jao at gnu.org
Fri Feb 19 13:28:34 EST 2010


Hi Stephen,

Stephen Tetley <stephen.tetley at gmail.com> writes:

> Hello Jose
>
>
> Looking at the source for iwlib.h the wireless_config struct doesn't
> have an essid_len field, at least in this version which seems to be
> current one:
>
> * Version :    22      16.3.07
>
> That said, if you are using this version then hsc2hs (the FFI
> preprocessor) should be throwing an error along the lines of
>
> error: structure has no member named 'essid_len'

I'm using the iwlib.h that comes with debian's libiw-dev package, which
claims to be version 30 9.4 of wireless tools (it's not clear to me to
what version of libiw that corresponds). At any rate, the iwlib.h in my
system defines a wireless_config struct with an essid_len (and hsc2hs is
thus not complaining). If i try to read the string from essid using
peekCString i also get a segfault.

> What command line flags are you using to compile?

i do a plain 'hsc2hs Wireless.hsc' and then either 'ghci -liw
Wireless.hs' (to try interactively) or 'ghc -o wire -liw Wireless.hs'.
I've also tried adding -O, but the results are the same.

Thanks a lot for your help,
jao



More information about the Beginners mailing list