2

I'd like to have similar functionality as stack install (e.g. the --copy-bins flag) does for executables, but for libraries.

Currently, I have to stack build and then manually find the libHS*-<version>-<fingerprint>.a files in .stack-work. That is problematic/uncomfy for two reason:

  1. I have to rely on the internal folder structure of stack (reliable enough, though)
  2. I have to manually get rid of the fingerprint and the version

Well, I could work around both, I guess, but I'd like to know if this might already be available/sensible to implement.


Some background, which may or may not be relevant to the question rather than to its motivation:

I am playing around with https://hackage.haskell.org/package/dynamic-loader-0.0/docs/System-Plugins-DynamicLoader.html and want to provide as realistic an example as I can, so I plan to compile a package's object code into a *.a (containing the compilation of multiple modules) which I want to link in at runtime.

What I want to do works already for trivial single module files, where I only need to use loadModule. Currently I'm tinkering around with loadPackage.

Sebastian Graf
  • 3,602
  • 3
  • 27
  • 38
  • I imagine you want to refer to a development/patched version of a library from another project that you are working on. The following answer should help: http://stackoverflow.com/questions/32849269/how-to-install-use-a-local-version-of-package-using-stack. – Steven Shaw Sep 07 '16 at 12:18
  • Uhmm no, I'm talking about binary artifacts here, for the sake of separate compilation. Actually what I want with the produced static lib is to load it at runtime. – Sebastian Graf Sep 07 '16 at 12:47
  • Rather than the `.a`, don't you want the `.so` (or what have you for your platform)? – Steven Shaw Sep 07 '16 at 14:23
  • That's a part I'm not sure about... I'm playing around with https://hackage.haskell.org/package/dynamic-loader-0.0/docs/System-Plugins-DynamicLoader.html . The API suggests to use object files, but there is also a function for DLLs. Regardless, it amounts to the same: I think there should be a way to 'deploy' both library types to a specified directory in their non-fingerprinted version. – Sebastian Graf Sep 07 '16 at 14:26
  • 1
    I understand. It's probably worth mentioning in your question though. – Steven Shaw Sep 07 '16 at 14:27

0 Answers0