Add pdynload hierarchical name test from Alistair Bayley

This commit is contained in:
Don Stewart 2005-08-27 03:17:55 +00:00
parent d380755047
commit 06f2abce6b
6 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,34 @@
module Load where
import API
import System.Plugins
testload = do
s <- make "../Plugin1.hs" ["-i../api"]
o1 <- case s of
MakeSuccess _ o -> return o
MakeFailure e -> mapM_ putStrLn e >> fail "o1"
s <- make "../Sub/Plugin2.hs" ["-i../api"]
o2 <- case s of
MakeSuccess _ o -> return o
MakeFailure e -> mapM_ putStrLn e >> fail "o2"
fc <- pdynload o1 ["..","../api"] [] "API.PluginAPI" "action"
case fc of
LoadFailure msg -> mapM_ putStrLn msg
LoadSuccess modul proc -> do
let ac :: API.PluginAPI; ac = proc
let s = proc 42
print s
print o2
fc <- pdynload o2 ["..","../api"] [] "API.PluginAPI" "action"
case fc of
LoadFailure msg -> mapM_ putStrLn msg
LoadSuccess modul proc -> do
let ac :: API.PluginAPI; ac = proc
let s = proc 42
print s

View File

@ -0,0 +1,5 @@
TEST=pdynload/bayley1
TOP=../../..
include ../../build.mk

View File

@ -0,0 +1,6 @@
module Plugin1 where
import qualified API
action :: API.PluginAPI
action i = show i

View File

@ -0,0 +1,6 @@
module Sub.Plugin2 where
import qualified API
action :: API.PluginAPI
action i = show i

View File

@ -0,0 +1,6 @@
module API where
type PluginAPI = Int -> String
action :: PluginAPI
action i = show i

View File

@ -0,0 +1,4 @@
module Main where
import Load
main = testload