Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cabal foreign-library support (using Haskell to create a shared library for other languages) #12

Open
CMCDragonkai opened this issue Feb 24, 2019 · 1 comment

Comments

@CMCDragonkai
Copy link
Member

If we ever want to use Haskell to write a shared object/library that is meant to be consumed by another language (like C or something that also has FFI). Then we can use the foreign-library feature of Cabal.

The feature is explained here: https://www.haskell.org/cabal/users-guide/developing-packages.html#foreign-libraries

And there's a tutorial about it: https://qnikst.github.io/posts/2018-05-02-cabal-foreign-library.html

However hpack currently doesn't support it yet: sol/hpack#258

This may be useful for cases like using Haskell code within a kernel module.

@minimapletinytools
Copy link

I added a demo of this using foreign-library feature here: https://github.com/pdlla/haskell-ffi-cabal-foreign-library-examples

As mentioned, hpack does not support it yet, however, it still works with stack as long as you write your own .cabal file (see stack branch, which will get merged eventually).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants