diff options
Diffstat (limited to 'packages/sundials/src/Bar.hsc')
-rw-r--r-- | packages/sundials/src/Bar.hsc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/sundials/src/Bar.hsc b/packages/sundials/src/Bar.hsc new file mode 100644 index 0000000..b1159b6 --- /dev/null +++ b/packages/sundials/src/Bar.hsc | |||
@@ -0,0 +1,24 @@ | |||
1 | {-# LANGUAGE RecordWildCards #-} | ||
2 | |||
3 | module Example where | ||
4 | |||
5 | import Foreign | ||
6 | import Foreign.C.Types | ||
7 | import Foreign.C.String | ||
8 | |||
9 | #include "/Users/dom/sundials/include/sundials/sundials_nvector.h" | ||
10 | #include "/Users/dom/sundials/include/nvector/nvector_serial.h" | ||
11 | |||
12 | #def typedef struct _generic_N_Vector BarType; | ||
13 | #def typedef struct _N_VectorContent_Serial BazType; | ||
14 | |||
15 | |||
16 | getContentPtr :: Storable a => Ptr b -> IO a | ||
17 | getContPtr ptr = (#peek BarType, content) ptr | ||
18 | |||
19 | getData ptr = (#peek BazType, data) ptr | ||
20 | |||
21 | foo ptr = do | ||
22 | qtr <- getContPtr ptr | ||
23 | getData qtr | ||
24 | |||