简体   繁体   中英

Linking custom object files with Cabal

In a custom cabal hook I generated object files (*.o) which I want to pass to the linker. 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.


As an aside, you should be aware that generating custom .o files is highly unusual, and likely to make your build fragile. Is there a particular reason why Cabal is unable to generate these .o files itself?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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