hs-plugins: dynamic linking error with .ctors section

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 Files\Haskell\RGPack-0.0\ghc-6.4.2/HSRGPack-0.0.o) 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. Cheers, Cyril

On 10/18/06, Cyril Schmidt
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 Files\Haskell\RGPack-0.0\ghc-6.4.2/HSRGPack-0.0.o)
I think this is fixed in ghc 6.6. There probably isn't a workaround without recompiling ghc from source (and fixing Linker.c in rts-dir.) Best regards, --Esa

Thanks! I'll upgrade as soon as I can. Regards, Cyril
When I try to load A.hs using hs-plugins, I get the following error: Unknown PEi386 section name `.ctors' (while processing: C:\Program Files\Haskell\RGPack-0.0\ghc-6.4.2/HSRGPack-0.0.o)
I think this is fixed in ghc 6.6. There probably isn't a workaround without recompiling ghc from source (and fixing Linker.c in rts-dir.)
Best regards, --Esa

Indeed, the code works when compiled by GHC 6.6. Cheers, Cyril Cyril Schmidt wrote:
When I try to load A.hs using hs-plugins, I get the following error: Unknown PEi386 section name `.ctors' (while processing: C:\Program Files\Haskell\RGPack-0.0\ghc-6.4.2/HSRGPack-0.0.o)
Esa Ilari Vuokko wrote:
I think this is fixed in ghc 6.6. There probably isn't a workaround without recompiling ghc from source (and fixing Linker.c in rts-dir.)
Best regards, --Esa

Hello Esa, Wednesday, October 18, 2006, 1:42:49 PM, you wrote:
When I try to load A.hs using hs-plugins, I get the following error: Unknown PEi386 section name `.ctors' (while processing: C:\Program Files\Haskell\RGPack-0.0\ghc-6.4.2/HSRGPack-0.0.o)
I think this is fixed in ghc 6.6. There probably isn't a workaround without recompiling ghc from source (and fixing Linker.c in rts-dir.)
and this problem was not fixed in 6.4 branch? -- Best regards, Bulat mailto:Bulat.Ziganshin@gmail.com
participants (3)
-
Bulat Ziganshin
-
Cyril Schmidt
-
Esa Ilari Vuokko