Re: [Haskell-cafe] FFI for a beginner

2011-07-14 Thread Andrew Pennebaker
FIXED IT!!! The problem with charm.hs and its FFI dependency charm.c is that both want to produce an intermediary charm.o file. Solution: rename charm.hs to hscharm.hs. Cheers, Andrew Pennebaker www.yellosoft.us On Tue, Apr 12, 2011 at 5:55 PM, Andrew Pennebaker andrew.penneba...@gmail.com

Re: [Haskell-cafe] FFI for a beginner

2011-07-14 Thread Simon Peyton-Jones
Subject: Re: [Haskell-cafe] FFI for a beginner FIXED IT!!! The problem with charm.hs and its FFI dependency charm.c is that both want to produce an intermediary charm.o file. Solution: rename charm.hs to hscharm.hs. Cheers, Andrew Pennebaker www.yellosoft.ushttp://www.yellosoft.us On Tue

Re: [Haskell-cafe] FFI for a beginner

2011-07-14 Thread Yves Parès
I think you should definitely use hsc2hs. It is simple to you use and would allow you to replace things like: peek ptr = do*a - peekByteOff ptr 0 b - peekByteOff ptr 4* return (MyStructType a b) By: #include MyStruct.h -- ^ Needs to be defined in a separate header peek ptr = do

Re: [Haskell-cafe] FFI for a beginner

2011-07-14 Thread Donn Cave
The docs http://www.haskell.org/ghc/docs/latest/html/users_guide/ffi-ghc.html#glasgow-foreign-headers say that -#include pragmas no longer work, but fail to explain how to load code without them. Suffice to say I have no recourse but trial and error. Ah, now that is a GHC documentation

Re: [Haskell-cafe] FFI for a beginner

2011-04-12 Thread Andrew Pennebaker
hsc2hs and c2hs are good suggestions, and some of the tutorials I'm following use them. But 1) Many Haskell FFI tutorials don't require them, so they only seem to help, or only help in older versions of GHC. And 2) When I did compile using c2hs, it just produced the same file, but with filler

[Haskell-cafe] FFI for a beginner

2011-04-08 Thread Andrew Pennebaker
ncurses is proving too difficult to setup, so I'm working on a new library called charm. The C code works by itself, but I can't compile a Haskell wrapper for it. While the tutorials at HaskellWikihttp://www.haskell.org/haskellwiki/FFI_complete_examplesare helpful, they're outdated. Argh! The