Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linking separate projects in GHC

Tags:

haskell

ghc

Ok this should be simple, but can't seem to figure this out. I have two projects, ProjectA and ProjectB. ProjectB depends on the old project, ProjectA. Now I want to build ProjectB. And I do not want to change the directory structure for ProjectA now. Problem is, I always used -outputdir bin with ProjectA.

ProjectA looked like this:

ProjectA/
  bin/
    (*.o, *.hi in proper paths, sometimes also *.p_o and *.p_hi)
  Foo/
    ModuleX.hs
  ModuleA.hs
  ModuleB.hs

Now I have a different folder with ProjectB, with its own separate -outputdir. I just need to link to the old project object files (without having ProjectA files recompiled). I realize that I can probably cabalize ProjectA ... but is there no simpler way?

like image 723
Samee Avatar asked Nov 04 '22 04:11

Samee


1 Answers

The "simple way" is to use Cabal. Once you've installed Project A, you never need to worry about where the hell it's actually stored ever again; GHC will just find it.

If you don't want to do this, try using the -i switch to GHC to tell what folders to search for your compiled stuff.

http://www.haskell.org/ghc/docs/7.0.1/html/users_guide/separate-compilation.html

like image 117
MathematicalOrchid Avatar answered Nov 13 '22 13:11

MathematicalOrchid