summaryrefslogtreecommitdiff
path: root/packages/sundials/src/Bar.hsc
blob: b1159b612078cfe5f73393802a468f6c6cfdbe27 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{-# LANGUAGE RecordWildCards #-}

module Example where

import Foreign
import Foreign.C.Types
import Foreign.C.String

#include "/Users/dom/sundials/include/sundials/sundials_nvector.h"
#include "/Users/dom/sundials/include/nvector/nvector_serial.h"

#def typedef struct _generic_N_Vector BarType;
#def typedef struct _N_VectorContent_Serial BazType;


getContentPtr :: Storable a => Ptr b -> IO a
getContPtr ptr = (#peek BarType, content) ptr

getData ptr = (#peek BazType, data) ptr

foo ptr = do
  qtr <- getContPtr ptr
  getData qtr