[Haskell-cafe] runghc and linking in libraries
Brandon Allbery
allbery.b at gmail.com
Thu Jul 20 15:00:35 UTC 2017
On Thu, Jul 20, 2017 at 2:25 AM, Brian Sammon <
haskell-cafe at brisammon.fastmail.fm> wrote:
> If I want to create a MyLib that uses C code (that I wrote) through FFI,
> it doesn't seem to be possible to use it in a runghc script like this,
> unless I create a package and install it. Am I correct about this?
You would have to explicitly link it in: runghc Foo.hs bar.o (or -lbar if
it's a library). It's not really designed for anything larger than a single
source file without non-package dependencies.
In the course of researching this, I realized that I have a rather poor
> understanding of what "packages" are in ghc-land. I have a
> high-level-overview understanding ("It's like rubygems, but for haskell"),
> but I'm rather unclear about the nuts-and-bolts of it.
> The tight coupling between packages and the ghc core is rather different
> than what I've seen in other programming languages I've used (I haven't
> programmed in Java though)
>
Have you programmed in C, especially with heavy use of inline or CPP? The
cause of the tight dependencies is that ghc inlines a lot of things, even
across modules; which means that even parts of a module that aren't
explicitly exported are generally visible for inlining. And performance
will suck if you defeat this.
--
brandon s allbery kf8nh sine nomine associates
allbery.b at gmail.com ballbery at sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad http://sinenomine.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20170720/5483c8c2/attachment.html>
More information about the Haskell-Cafe
mailing list