Note that there are some explanatory texts on larger screens.

plurals
  1. POCreating Haskell shared libraries on OS X
    primarykey
    data
    text
    <p>I'm trying to create a shared library from Haskell source code.</p> <p>I've tried following the instruction here: <a href="http://weblog.haskell.cz/pivnik/building-a-shared-library-in-haskell/">http://weblog.haskell.cz/pivnik/building-a-shared-library-in-haskell/</a> but I'm just not having any luck.</p> <p>When I compile with Haskell 64-bit (ghc 7.0.4 from 2011.4.0.0) I get the following error:</p> <pre><code>ld: pointer in read-only segment not allowed in slidable image, used in ___gmpn_modexact_1c_odd </code></pre> <p>As an alternative I also tried the 32-bit version, and depending on the exact flags I use to link get errors such as:</p> <pre><code>Library not loaded: /usr/local/lib/ghc-7.0.4/base-4.3.1.0/libHSbase-4.3.1.0-ghc7.0.4.dylib </code></pre> <p>I did manage to get a little further by adding -lHSrts to the linker line. This got me to the point of successfully linking and loading the library, but I'm then unable to find the function name using dlsym (or manually using nm | grep)</p> <p>Any hints would be greatly appreciated, an example make file, or build line that has successfully built (and used) a shared library on OS X would be appreciated. I'm quite new to Haskell and don't know if I should keep banging my head assuming that the problem is on my end, or for various reasons I shouldn't expect this to work on OS X.</p> <p>A git repo with all the combinations I've tried is available here: <a href="https://github.com/bennoleslie/haskell-shared-example">https://github.com/bennoleslie/haskell-shared-example</a> I did manage to get something working for 32-bit ghc, but not 64-bit yet.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload