Update examples

This commit is contained in:
Don Stewart
2005-09-03 04:45:14 +00:00
parent 5321754614
commit dff0363224
421 changed files with 19 additions and 9 deletions

View File

@ -0,0 +1,4 @@
TEST=makewith/should_fail_0
TOP=../../..
include ../../build.mk

View File

@ -0,0 +1,3 @@
module Plugin where
resource = 0xBAD :: Int

View File

@ -0,0 +1,6 @@
module Plugin ( resource ) where
import API
resource :: Interface
resource = plugin

View File

@ -0,0 +1,10 @@
module API where
data Interface = Interface {
function :: String
}
plugin :: Interface
plugin = Interface { function = "goodbye" }

View File

@ -0,0 +1,19 @@
import System.Plugins
import API
conf = "../Plugin.in"
stub = "../Plugin.stub"
main = do
status <- makeWith conf stub ["-i../api"]
case status of
MakeFailure e -> putStrLn "make failed"
MakeSuccess _ o -> do
m_v <- load o ["../api"] [] "resource"
v <- case m_v of
LoadSuccess _ v -> return v
_ -> error "load failed"
putStrLn $ (function v)
makeCleaner o

View File

@ -0,0 +1 @@
make failed