Interface Files _ HOWTO?
Simon Peyton-Jones
simonpj@microsoft.com
Mon, 23 Oct 2000 01:26:15 -0700
Compile the module from bottom to top, with -c. Then link. THus
ghc -c MyList.hs
ghc -c ListFun.hs
...etc...
ghc -c Main.hs
ghc -o MyApp MyList.o ListFun.o ... Main.o
Simon
| -----Original Message-----
| From: Ingo Sander [mailto:ingo@ele.kth.se]
| Sent: 20 October 2000 17:09
| To: glasgow-haskell-users@haskell.org
| Subject: Interface Files _ HOWTO?
|
|
| After working a lot with Hugs I tried to compile my Haskell
| code with GHC.
| But it does not work, I am not able to figure out how to work with the
| interface files (.hi). My program is build out of several
| modules, like
| this (much simpler, but facing the same problem...)
|
| File MyList.hs
| ==============
|
| module MyList(MkList(Empty, (:-))) where
|
| infixr 5 :-
|
| data MkList a = Empty
| | a :- (MkList a) deriving (Eq, Show)
|
|
| File ListFun.hs
| ===============
|
| module ListFun(mapL) where
|
| import MyList
|
| mapL f Empty = Empty
| mapL f (x:-xs) = f x :- mapL f xs
|
|
|
| File ListLib
| ============
|
| module ListLib(module MyList, module ListFun) where
|
| import MyList
| import ListFun
|
|
| File Main.hs
| ============
|
| module Main(main) where
|
| import ListLib
|
| main = putStr (show (mapL (+1) (1:-2:-Empty)))
|
|
|
| As I said the code works with hugs, and I want to have the
| hierarchy in
| the library structure.
|
| So, how do I compile this in GHC? I hoped, that it would be enough to
| compile all files with the -c option (generating .hi and .o files) and
| then compiling Main.hs to get an executable program. Howeve, I get the
| following:
|
| > ghc Main.hs
| ghc: module version unchanged at 7
| Undefined first referenced
| symbol in file
| MyList_ZCzm_con_info Main.o
| MyList_zdfShowMkList_closure Main.o
| ListFun_mapL_closure Main.o
| MyList_Empty_static_closure Main.o
| ld: fatal: Symbol referencing errors. No output written to a.out
|
| So, what's wrong, and am I totally on the wrong track... (I
| studied the
| GHC User Guide, but could not find the answer to my problem).
|
| Thanks in advance!
|
| Ingo Sander
|
|
|
| _______________________________________________
| Glasgow-haskell-users mailing list
| Glasgow-haskell-users@haskell.org
| http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
|