hs-plugins -- simple example fails
Peter Collingbourne
pcc03 at doc.ic.ac.uk
Fri Feb 22 09:39:36 EST 2008
Hello,
I'm having problems trying to use hs-plugins (the darcs version, as I
am on a 64-bit machine). The test suite mostly works without problems,
but I can't get my own code to work. I put together a simple example
which illustrates my problem:
Main.hs
====================
module Main (Tree(..), Interface(..), main) where
import Ptr
import System.Plugins
data Tree = Tree (Ptr Tree)
data Interface = Interface {
processTree :: Ptr Tree -> IO (Ptr Tree)
}
main = load "XYZuse.o" ["."] [] "resource" >>= (\(LoadSuccess _ v) -> (processTree v nullPtr))
====================
XYZuse.hs
====================
module XYZuse (resource) where
import Main
resource = Interface {
processTree = return
}
====================
This is the output I get:
====================
$ ghc -c -o Main.o Main.hs
$ ghc -c -o XYZuse.o XYZuse.hs
$ ghci
___ ___ _
/ _ \ /\ /\/ __(_)
/ /_\// /_/ / / | | GHC Interactive, version 6.6, for Haskell 98.
/ /_\\/ __ / /___| | http://www.haskell.org/ghc/
\____/\/ /_/\____/|_| Type :? for help.
Loading package base ... linking ... done.
Prelude> :l Main
Ok, modules loaded: Main.
Prelude Main> main
Loading package Cabal-1.1.6 ... linking ... done.
Loading package haskell98 ... linking ... done.
Loading package haskell-src-1.0 ... linking ... done.
Loading package plugins-1.0 ... linking ... done.
GHCi runtime linker: fatal error: I found a duplicate definition for symbol
Main_processTree_closure
whilst processing object file
./Main.o
This could be caused by:
* Loading two different object files which export the same symbol
* Specifying the same object file twice on the GHCi command line
* An incorrect `package.conf' entry, causing some object to be
loaded twice.
GHCi cannot safely continue in this situation. Exiting now. Sorry.
====================
Thanks,
--
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20080222/fd71f634/attachment.bin
More information about the Glasgow-haskell-users
mailing list