The duplicate definition error appears when I compile Main.hs and execute it. But when I run it with runghc the behaviour is different. It works well:<div><br></div><div>> runghc Main.hs<br>3</div><div><br></div><div>Any idea? is this a bug of hs-plugins? it is just something expected??</div>
<div><br><div class="gmail_quote">2008/12/6 Alberto G. Corona <span dir="ltr"><<a href="mailto:agocorona@gmail.com">agocorona@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="Ih2E3d">I have a web server which load server extensions. these extensions eval-uate configuration files that contains code (user-editable workflow descriptions). The problem is that I need common definitions (inside imported modules) for the extensions and for the configuration files. This is not permitted by ha-plugins.<br>
</div><div class="gmail_quote"><div class="Ih2E3d">
<br>The minimal code example are the files below. main loads eval.hs , that evaluate a expression. The common definitions are in Include.hs. The error is:<br><br></div><i><div class="Ih2E3d">GHCi runtime linker: fatal error: I found a duplicate definition for symbol<br>
</div>
Include_sum1_srt<br>whilst processing object file<br> /home/magocoal/haskell/devel/votesWorkflow/src/unused/tests/Include.o<div><div></div><div class="Wj3C7c"><br>This could be caused by:<br> * Loading two different object files which export the same symbol<br>
* Specifying the same object file twice on the GHCi command line<br> * An incorrect `package.conf' entry, causing some object to be<br> loaded twice.<br>GHCi cannot safely continue in this situation. Exiting now. Sorry.<br>
</div></div></i><div><div></div><div class="Wj3C7c"><br><br><i></i><br>Do you kno how to solve the problem while maintaining the functionality?<br>
<br>-------Include.hs-------<br>module Include where<br><br>sum [x,y]= x+y<br><br><br>------Main.hs----- <br>module Main where <br>
import Include<br>import System.Plugins<br><br>main= do<br> s <-loadExec "eval.o" "mainc" <br> print s<br> <br>loadExec:: String-> String->IO String
<br>loadExec file method = do
<br>
<br> mv <- load file ["."] [] method
<br> case mv of
<br> LoadSuccess mod v -> v :: IO String
<br> LoadFailure msg -> return $ concat msg
<br> <br><br><br>------------Eval.hs--------<br><br>module Eval(mainc) where<br></div></div><div class="Ih2E3d">import System.IO.Unsafe<br>import System.Eval.Haskell<br><br></div>mainc= do i <- unsafeEval_ "sum1 [1,2]" ["Include"] [] []["."] :: IO (Either [String] Int)<br>
return $ show i <br><br><br> <br></div><br>
</blockquote></div><br></div>