简体   繁体   English

将自定义对象文件与Cabal链接

[英]Linking custom object files with Cabal

In a custom cabal hook I generated object files (*.o) which I want to pass to the linker. 在自定义cabal挂钩中,我生成了我想传递给链接器的目标文件(* .o)。 How do I do this idiomatically? 我如何惯用这个?

Solution Don Stewart's answer goes in the right direction. 解决方案唐斯图尔特的答案朝着正确的方向发展。 Currently I do the following: 目前我做以下事情:

$ runhaskell Setup.lhs build --ld-options="PATHS TO .o FILES"

According to the Cabal documentation for UserHooks , it looks like you'll need to add a buildHook , by specifying additional build flags , that add your .o files to the buildFlags for ld. 根据UserHooksCabal文档 ,看起来你需要添加一个buildHook ,通过指定额外的构建标志 ,将.o文件添加到ld的buildFlags


As an aside, you should be aware that generating custom .o files is highly unusual, and likely to make your build fragile. 另外,您应该知道生成自定义.o文件非常不寻常,并且可能会使您的构建变得脆弱。 Is there a particular reason why Cabal is unable to generate these .o files itself? Cabal无法生成这些.o文件的特殊原因吗?

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

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