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

foreign-libraries + getDynLibDir #10762

Open
dmwit opened this issue Jan 19, 2025 · 0 comments
Open

foreign-libraries + getDynLibDir #10762

dmwit opened this issue Jan 19, 2025 · 0 comments

Comments

@dmwit
Copy link
Collaborator

dmwit commented Jan 19, 2025

It would be nice if cabal made foreign-libraries available at cabal run time. There are various ways this could work, and I freely admit that what I describe below is just one idea for this.

I am developing an application with three components: a Haskell executable, a third-party executable (not controlled by cabal), and a shared library which will be loaded by the third-party executable to facilitate communication with the Haskell executable. I'd like cabal to be in charge of building the shared library and making it available to the third-party executable.

I have found I can get cabal to build the library by making a foreign-library stanza. This results in a suitable .so file being created inside dist-newstyle; if I cabal install, I expect that .so would even be placed somewhere reasonably discoverable (I haven't tested this). But I don't see a (robust) way of finding that file from within either my Haskell executable or the third-party executable during development.

It would be nice if cabal created a directory inside dist-newstyle with links to the foreign-library build products, then set the appropriate environment variable so that Paths_foo.getDynLibDir returned that directory. Bonus points if I can add foo:bar to the build-depends field to tell cabal that I depend on package foo's foreign-library bar and ensure that the appropriate link/build product is up-to-date when calling cabal run.

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

No branches or pull requests

1 participant