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= loadCLib/null
EXTRA_OBJS=Null.o
TOP=../../..
include ../../build.mk

View File

@ -0,0 +1,12 @@
module Null ( resource ) where
import API
import Data.Dynamic
import Prelude hiding (null)
import Graphics.Rendering.OpenGL
resource = null
-- ! this has to be special: it can't be overridden by the user.
resource_dyn :: Dynamic
resource_dyn = toDyn resource

View File

@ -0,0 +1,12 @@
{-# OPTIONS -fglasgow-exts #-}
module API where
import Data.Dynamic
data Null = Null { a, b :: Int }
deriving (Typeable, Show)
null :: Null
null = Null { a = 42 , b = 1 }

View File

@ -0,0 +1,11 @@
import System.Plugins
import API
-- an example where we just want to load an object and run it
main = do
m_v <- load_ "../Null.o" ["../api",".."] "resource"
case m_v of
LoadFailure err -> error (unlines err)
LoadSuccess m v -> do putStrLn ( show (a v) ) ; unload m

View File

@ -0,0 +1 @@
42