简体   繁体   English

将GHC中的单独项目联系起来

[英]Linking separate projects in GHC

Ok this should be simple, but can't seem to figure this out. 好的,这应该很简单,但似乎无法解决这个问题。 I have two projects, ProjectA and ProjectB. 我有两个项目,ProjectA和ProjectB。 ProjectB depends on the old project, ProjectA. ProjectB依赖于旧项目ProjectA。 Now I want to build ProjectB. 现在我想构建ProjectB。 And I do not want to change the directory structure for ProjectA now. 我现在不想更改ProjectA的目录结构。 Problem is, I always used -outputdir bin with ProjectA. 问题是,我总是在ProjectA中使用-outputdir bin。

ProjectA looked like this: ProjectA看起来像这样:

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. 现在我有一个与ProjectB不同的文件夹,它有自己独立的-outputdir。 I just need to link to the old project object files (without having ProjectA files recompiled). 我只需要链接到旧的项目对象文件(不重新编译ProjectA文件)。 I realize that I can probably cabalize ProjectA ... but is there no simpler way? 我意识到我可能会把ProjectA搞砸......但是没有更简单的方法吗?

The "simple way" is to use Cabal. “简单的方法”是使用Cabal。 Once you've installed Project A, you never need to worry about where the hell it's actually stored ever again; 一旦你安装了Project A,你就再也不用担心它实际存储在哪里了。 GHC will just find it. GHC会找到它。

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. 如果您不想这样做,请尝试使用-i开关到GHC来告诉搜索已编译内容的文件夹。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM