Re: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-15 Thread DNM
Hi all, I got it to work...finally. Basically, I used Malcolm's suggestion of tracking down all the SRILM .o files needed. I need to run now, but I'll post the gory (oh, so gory) details soon. Thanks to all who helped. Best, D.N. -- View this message in context: http://old.nabble.com/FFI%2C

Re: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-14 Thread DNM
Nope. Ubuntu Linux (Intrepid Ibex). I wish it were that simple. --D.N. Daniel Fischer-4 wrote: > > Am Donnerstag 14 Januar 2010 20:42:42 schrieb DNM: >> Which is weird, because 'srilm.o'/'srilm.h' are the files that define >> the mysterious "unde

Re: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-14 Thread DNM
Which is weird, because 'srilm.o'/'srilm.h' are the files that define the mysterious "undefined references". I'll keep plugging away and report back when (or whether) I make some progress. In the meanwhile, if anyone has a clue, I'm all ears. Best, D.N. Malcolm Wallace wrote: > > However, if

Re: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-14 Thread DNM
sn't run. It's an object file, not an executable (not being from the C/C++ world, being a distinction I did not have at the forefront of my mind). Anyhow, still no dice. Even when cleaning up my Haskell code, I can't get this to compile. --D.N. DNM wrote: > > Note: I'

Re: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-13 Thread DNM
Sorry. In my haste to paste in the .c file, I left out all the include statements. I do have #include "srilm.h" there (which to my non- C/C++ mind seems stupid -- why the hell would you need to import the header file for the code that it's a header *for*?) Still no dice. Thanks for your time,

Re: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-13 Thread DNM
Malcolm, I saw this suggestion somewhere else. Unfortunately, it didn't help either. I still get the "undefined reference" errors. I did eventually get ghc to compile Main.hs by putting the -c and -cpp flags after "--make Main.hs". Then it produces a Main.o file which (even with +x permissions

Re: [Haskell-cafe] FFI, C/C++ and undefined references

2010-01-13 Thread DNM
Bulat, Some very good suggestions. I will try to appease Ceiling Cat and reduce my (perhaps gratuitous) use of unsafePerformIO. I'm going to have to use it somewhere, since I want referentially transparent code (and I try to avoid the IO monad when possible, anyway). > 2. if your function retu

[Haskell-cafe] FFI, C/C++ and undefined references

2010-01-12 Thread DNM
Note: I'm relatively new to Haskell, and my knowledge of C and C++ is basically pretty minimal -- I can read, modify and compile C/C++ programs (usually). I'm trying to interface with some C++ code by writing a little bit of C code that uses that C++ code, and I'm getting "undefined reference" er

Re: Re: [Haskell-cafe] Problem with result-type context restrictions in typeclasses.

2009-09-29 Thread DNM
ciated with typeclasses, but type functions associated > with them too. In this case you can think of Ret as a function that > takes a type (G in the instance above) and returns another type (FU). > Each instance can define new mappings for Ret. > > Hope this helps! > > Dan &

[Haskell-cafe] Re: Problem with result-type context restrictions in typeclasses.

2009-09-29 Thread DNM
e of 'Bar' (viz., FU or FI) later on when I implement 'foo' in each type classes. On Sep 29, 10:43 pm, DNM wrote: > N.B. I'm a newbie to Haskell, and this problem is a bit complex, so > bear with me. > > I'm using typeclasses to implement a sort of common

[Haskell-cafe] Problem with result-type context restrictions in typeclasses.

2009-09-29 Thread DNM
N.B. I'm a newbie to Haskell, and this problem is a bit complex, so bear with me. I'm using typeclasses to implement a sort of common interface for all things -- call them things of type 'Cls' -- that can be expected to implement a set of functions -- an 'interface' in OOP-speak. (Yes, yes, I'm a