hs-plugins: dynamic linking error with .ctors section

Cyril Schmidt cschmidt at deds.nl
Wed Oct 18 05:21:40 EDT 2006

I am using hs-plugins to load some Haskell modules dynamically.
It all goes well until I try to load a module that uses a package
with some C++ code in the implementation.

The module in question, A.hs, uses a package named RGPack, which
consists of some C++ code and a single Haskell module that provides
the necessary `foreign import' declarations. The package (including
the C++ code) is built by GHC.

When I try to load A.hs using hs-plugins, I get the following error:
Unknown PEi386 section name `.ctors' (while processing: C:\Program

When I link A.hs statically (using `import A' in my main module),
it works fine.

I am fairly sure that the problem is somehow related to the usage
of the C++ code in the package (because .ctors section is C++-specific),
but I have no idea how I can remedy this. Rewriting the C++ code to
pure C is an obvious workaround, but I'd prefer to try something else
before I resort to this ;-)

For the record, I use GHC 6.4.2 on Windows, hs-plugins-1.0-rc0.

I will greatly appreciate any hints.



More information about the Libraries mailing list