diff --git a/fficxx.cabal b/fficxx.cabal
--- a/fficxx.cabal
+++ b/fficxx.cabal
@@ -1,5 +1,5 @@
 Name:           fficxx
-Version:        0.5.0.1
+Version:        0.5.1
 Synopsis:       automatic C++ binding generation
 Description:    automatic C++ binding generation
 License:        BSD3
diff --git a/lib/FFICXX/Generate/Builder.hs b/lib/FFICXX/Generate/Builder.hs
--- a/lib/FFICXX/Generate/Builder.hs
+++ b/lib/FFICXX/Generate/Builder.hs
@@ -4,7 +4,7 @@
 -----------------------------------------------------------------------------
 -- |
 -- Module      : FFICXX.Generate.Builder
--- Copyright   : (c) 2011-2018 Ian-Woo Kim
+-- Copyright   : (c) 2011-2019 Ian-Woo Kim
 --
 -- License     : BSD3
 -- Maintainer  : Ian-Woo Kim <ianwookim@gmail.com>
@@ -15,27 +15,32 @@
 
 module FFICXX.Generate.Builder where
 
-import           Control.Monad                           (void,when)
+import           Control.Monad                           ( void, when )
 import qualified Data.ByteString.Lazy.Char8        as L
-import           Data.Char                               (toUpper)
-import           Data.Digest.Pure.MD5                    (md5)
-import           Data.Foldable                           (for_)
-import           Data.Monoid                             ((<>),mempty)
-import           Language.Haskell.Exts.Pretty            (prettyPrint)
-import           System.FilePath                         ((</>),(<.>),splitExtension)
-import           System.Directory                        (copyFile, doesDirectoryExist
-                                                         ,doesFileExist,getCurrentDirectory)
-import           System.IO                               (hPutStrLn,withFile,IOMode(..))
-import           System.Process                          (readProcess,system )
+import           Data.Char                               ( toUpper )
+import           Data.Digest.Pure.MD5                    ( md5 )
+import           Data.Foldable                           ( for_ )
+import           Data.Monoid                             ( (<>), mempty )
+import           Language.Haskell.Exts.Pretty            ( prettyPrint )
+import           System.FilePath                         ( (</>), (<.>), splitExtension )
+import           System.Directory                        ( copyFile
+                                                         , createDirectoryIfMissing
+                                                         , doesFileExist
+                                                         )
+import           System.IO                               ( hPutStrLn, withFile, IOMode(..) )
+import           System.Process                          ( readProcess )
 --
 import           FFICXX.Generate.Code.Cabal
 import           FFICXX.Generate.Dependency
-import           FFICXX.Generate.Config
+import           FFICXX.Generate.Config                  ( FFICXXConfig(..)
+                                                         , SimpleBuilderConfig(..)
+                                                         )
 import           FFICXX.Generate.ContentMaker
-import           FFICXX.Generate.Type.Cabal              (Cabal(..),CabalName(..)
-                                                         ,AddCInc(..),AddCSrc(..))
-import           FFICXX.Generate.Type.Config             (ModuleUnitMap(..))
-import           FFICXX.Generate.Type.Class
+import           FFICXX.Generate.Type.Cabal              ( Cabal(..)
+                                                         , CabalName(..)
+                                                         , AddCInc(..)
+                                                         , AddCSrc(..)
+                                                         )
 import           FFICXX.Generate.Type.Module
 import           FFICXX.Generate.Type.PackageInterface
 import           FFICXX.Generate.Util
@@ -44,26 +49,28 @@
 macrofy :: String -> String
 macrofy = map ((\x->if x=='-' then '_' else x) . toUpper)
 
-simpleBuilder :: String
-              -> ModuleUnitMap
-              -> (Cabal, [Class], [TopLevelFunction], [(TemplateClass,HeaderName)])
-              -> [String] -- ^ extra libs
-              -> [(String,[String])] -- ^ extra module
-              ->  IO ()
-simpleBuilder topLevelMod mumap (cabal,classes,toplevelfunctions,templates) extralibs extramods = do
+
+simpleBuilder :: FFICXXConfig -> SimpleBuilderConfig -> IO ()
+simpleBuilder cfg sbc = do
   putStrLn "----------------------------------------------------"
   putStrLn "-- fficxx code generation for Haskell-C++ binding --"
   putStrLn "----------------------------------------------------"
-
-  let pkgname = cabal_pkgname cabal
+  let SimpleBuilderConfig
+        topLevelMod
+        mumap
+        cabal
+        classes
+        toplevelfunctions
+        templates
+        extralibs
+        extramods
+        staticFiles
+        = sbc
+      pkgname = cabal_pkgname cabal
   putStrLn ("Generating " <> unCabalName pkgname)
-  cwd <- getCurrentDirectory
-  let cfg =  FFICXXConfig { fficxxconfig_scriptBaseDir = cwd
-                          , fficxxconfig_workingDir = cwd </> "working"
-                          , fficxxconfig_installBaseDir = cwd </> unCabalName pkgname
-                          }
-      workingDir = fficxxconfig_workingDir cfg
+  let workingDir = fficxxconfig_workingDir cfg
       installDir = fficxxconfig_installBaseDir cfg
+      staticDir  = fficxxconfig_staticFileDir cfg
 
       pkgconfig@(PkgConfig mods cihs tih tcms _tcihs _ _) =
         mkPackageConfig
@@ -75,11 +82,14 @@
       cabalFileName = unCabalName pkgname <.> "cabal"
       jsonFileName = unCabalName pkgname <.> "json"
   --
-  notExistThenCreate workingDir
-  notExistThenCreate installDir
-  notExistThenCreate (installDir </> "src")
-  notExistThenCreate (installDir </> "csrc")
+  createDirectoryIfMissing True workingDir
+  createDirectoryIfMissing True installDir
+  createDirectoryIfMissing True (installDir </> "src")
+  createDirectoryIfMissing True (installDir </> "csrc")
   --
+  putStrLn "Copying static files"
+  mapM_ (\x->copyFileWithMD5Check (staticDir </> x) (installDir </> x)) staticFiles
+  --
   putStrLn "Generating Cabal file"
   buildCabalFile cabal topLevelMod pkgconfig extralibs (workingDir</>cabalFileName)
   --
@@ -187,12 +197,6 @@
 touch fp = void (readProcess "touch" [fp] "")
 
 
-notExistThenCreate :: FilePath -> IO ()
-notExistThenCreate dir = do
-    b <- doesDirectoryExist dir
-    if b then return () else system ("mkdir -p " <> dir) >> return ()
-
-
 copyFileWithMD5Check :: FilePath -> FilePath -> IO ()
 copyFileWithMD5Check src tgt = do
   b <- doesFileExist tgt
@@ -240,7 +244,7 @@
       newfpath = ddir </> mdir </> mfile' <> fnameext
   b <- doesFileExist origfpath
   when b $ do
-    notExistThenCreate (ddir </> mdir)
+    createDirectoryIfMissing True (ddir </> mdir)
     copyFileWithMD5Check origfpath newfpath
 
 
diff --git a/lib/FFICXX/Generate/Code/Cabal.hs b/lib/FFICXX/Generate/Code/Cabal.hs
--- a/lib/FFICXX/Generate/Code/Cabal.hs
+++ b/lib/FFICXX/Generate/Code/Cabal.hs
@@ -3,7 +3,7 @@
 -----------------------------------------------------------------------------
 -- |
 -- Module      : FFICXX.Generate.Code.Cabal
--- Copyright   : (c) 2011-2018 Ian-Woo Kim
+-- Copyright   : (c) 2011-2019 Ian-Woo Kim
 --
 -- License     : BSD3
 -- Maintainer  : Ian-Woo Kim <ianwookim@gmail.com>
@@ -16,7 +16,7 @@
 
 import Data.Aeson.Encode.Pretty    (encodePretty)
 import qualified Data.ByteString.Lazy as BL
-import Data.List                   (nub)
+import Data.List                   (intercalate, nub)
 import Data.Monoid                 ((<>))
 import Data.Text                   (Text)
 import Data.Text.Template          (substitute)
@@ -25,15 +25,19 @@
 import qualified Data.Text.IO as TIO (writeFile)
 import System.FilePath             ((<.>),(</>))
 --
-import FFICXX.Generate.Type.Cabal  (AddCInc(..),AddCSrc(..)
-                                   ,CabalName(..),Cabal(..)
-                                   ,GeneratedCabalInfo(..))
+import FFICXX.Generate.Type.Cabal  ( AddCInc(..)
+                                   , AddCSrc(..)
+                                   , BuildType(..)
+                                   , CabalName(..)
+                                   , Cabal(..)
+                                   , GeneratedCabalInfo(..)
+                                   )
 import FFICXX.Generate.Type.Module
 import FFICXX.Generate.Type.PackageInterface
 import FFICXX.Generate.Util
 
 
-cabalIndentation :: Text -- String
+cabalIndentation :: Text
 cabalIndentation = T.replicate 23 " "
 
 
@@ -147,8 +151,8 @@
   \Maintainer:  $maintainer\n\
   \Category:       $category\n\
   \Tested-with:    GHC >= 7.6\n\
-  \Build-Type:  $buildtype\n\
-  \cabal-version:  >=1.10\n\
+  \$buildtype\n\
+  \cabal-version:  >= 2\n\
   \Extra-source-files:\n\
   \$extraFiles\n\
   \$csrcFiles\n\
@@ -160,14 +164,14 @@
   \  hs-source-dirs: src\n\
   \  ghc-options:  -Wall -funbox-strict-fields -fno-warn-unused-do-bind -fno-warn-orphans -fno-warn-unused-imports\n\
   \  ghc-prof-options: -caf-all -auto-all\n\
-  \  cc-options: $ccOptions\n\
+  \  cxx-options: $cxxOptions\n\
   \  Build-Depends: $pkgdeps\n\
   \  Exposed-Modules:\n\
   \$exposedModules\n\
   \  Other-Modules:\n\
   \$otherModules\n\
   \  extra-lib-dirs: $extralibdirs\n\
-  \  extra-libraries:    stdc++ $extraLibraries\n\
+  \  extra-libraries:    $extraLibraries\n\
   \  Include-dirs:       csrc $extraincludedirs\n\
   \  pkgconfig-depends: $pkgconfigDepends\n\
   \  Install-includes:\n\
@@ -204,11 +208,17 @@
      , gci_author           = ""
      , gci_maintainer       = ""
      , gci_category         = ""
-     , gci_buildtype        = "Simple"
+     , gci_buildtype        = case cabal_buildType cabal of
+                                Simple ->
+                                  "Build-Type: Simple"
+                                Custom deps ->
+                                     "Build-Type: Custom\ncustom-setup\n  setup-depends: "
+                                  <> T.pack (intercalate ", " (map unCabalName deps))
+                                  <> "\n"
      , gci_extraFiles       = map T.pack extrafiles
      , gci_csrcFiles        = map T.pack $ genCsrcFiles (tih,classmodules) acincs acsrcs
      , gci_sourcerepository = ""
-     , gci_ccOptions        = ["-std=c++14"]
+     , gci_cxxOptions       = ["-std=c++14"]
      , gci_pkgdeps          = map T.pack $ genPkgDeps (cabal_additional_pkgdeps cabal)
      , gci_exposedModules   = map T.pack $ genExposedModules summarymodule (classmodules,tmods)
      , gci_otherModules     = map T.pack $ genOtherModules classmodules
@@ -237,7 +247,7 @@
                , ("maintainer"      , gci_maintainer)
                , ("category"        , gci_category)
                , ("sourcerepository", gci_sourcerepository)
-               , ("ccOptions"       , T.intercalate " " gci_ccOptions)
+               , ("cxxOptions"       , T.intercalate " " gci_cxxOptions)
                , ("pkgdeps"         , T.intercalate ", " gci_pkgdeps)
                , ("extraFiles"      , unlinesWithIndent gci_extraFiles)
                , ("csrcFiles"       , unlinesWithIndent gci_csrcFiles)
diff --git a/lib/FFICXX/Generate/Code/Cpp.hs b/lib/FFICXX/Generate/Code/Cpp.hs
--- a/lib/FFICXX/Generate/Code/Cpp.hs
+++ b/lib/FFICXX/Generate/Code/Cpp.hs
@@ -366,7 +366,7 @@
     in intercalateWith connBSlash id [declstr, "{", returnstr, "}"]
   | otherwise =
     let declstr = funcToDecl c func
-        callstr = "to_nonconst<Type,Type ## _t>(p)->"
+        callstr = "TYPECASTMETHOD(Type,"<> aliasedFuncName c func <> "," <> class_name c <> ")(p)->"
                   <> cppFuncName c func <> "("
                   <> argsToCallString (genericFuncArgs func)
                   <> ")"
diff --git a/lib/FFICXX/Generate/Code/HsFrontEnd.hs b/lib/FFICXX/Generate/Code/HsFrontEnd.hs
--- a/lib/FFICXX/Generate/Code/HsFrontEnd.hs
+++ b/lib/FFICXX/Generate/Code/HsFrontEnd.hs
@@ -35,7 +35,6 @@
                                                )
 import FFICXX.Generate.Name                    (accessorName
                                                ,aliasedFuncName
-                                               ,constructorName
                                                ,hsClassName
                                                ,hscAccessorName
                                                ,hscFuncName
@@ -93,7 +92,7 @@
         -- cann = maybe "" id $ M.lookup (PkgMethod, constructorName c) amap
         -- newfuncann = mkComment 0 cann
         rhs = app (mkVar (hsFuncXformer f)) (mkVar (hscFuncName c f))
-    in mkFun (constructorName c) (functionSignature c f) [] rhs Nothing
+    in mkFun (aliasedFuncName c f) (functionSignature c f) [] rhs Nothing
 
 genHsFrontInstNonVirtual :: Class -> [Decl ()]
 genHsFrontInstNonVirtual c =
diff --git a/lib/FFICXX/Generate/Code/Primitive.hs b/lib/FFICXX/Generate/Code/Primitive.hs
--- a/lib/FFICXX/Generate/Code/Primitive.hs
+++ b/lib/FFICXX/Generate/Code/Primitive.hs
@@ -24,18 +24,46 @@
 ctypToStr :: CTypes -> IsConst -> String
 ctypToStr ctyp isconst =
   let typword = case ctyp of
-        CTString -> "char*"
-        CTChar   -> "char"
-        CTInt    -> "int"
-        CTUInt   -> "unsigned int"
-        CTLong   -> "signed long"
-        CTULong  -> "long unsigned int"
+        CTBool -> "bool"
+        CTChar -> "char"
+        CTClock -> "clock_t"
         CTDouble -> "double"
-        CTBool   -> "int"              -- Currently available solution
-        CTDoubleStar -> "double *"
+        CTFile -> "FILE"
+        CTFloat -> "float"
+        CTFpos -> "fpos_t"
+        CTInt -> "int"
+        CTIntMax -> "intmax_t"
+        CTIntPtr -> "intptr_t"
+        CTJmpBuf -> "jmp_buf"
+        CTLLong -> "long long"
+        CTLong -> "long"
+        CTPtrdiff -> "ptrdiff_t"
+        CTSChar -> "sized char"
+        CTSUSeconds -> "suseconds_t"
+        CTShort -> "short"
+        CTSigAtomic -> "sig_atomic_t"
+        CTSize -> "size_t"
+        CTTime -> "time_t"
+        CTUChar -> "unsigned char"
+        CTUInt -> "unsigned int"
+        CTUIntMax -> "uintmax_t"
+        CTUIntPtr -> "uintptr_t"
+        CTULLong -> "unsigned long long"
+        CTULong -> "unsigned long"
+        CTUSeconds -> "useconds_t"
+        CTUShort -> "unsigned short"
+        CTWchar -> "wchar_t"
+        CTInt8 -> "int8_t"
+        CTInt16 -> "int16_t"
+        CTInt32 -> "int32_t"
+        CTInt64 -> "int64_t"
+        CTUInt8 -> "uint8_t"
+        CTUInt16 -> "uint16_t"
+        CTUInt32 -> "uint32_t"
+        CTUInt64 -> "uint64_t"
+        CTString -> "char*"
         CTVoidStar -> "void*"
-        CTIntStar -> "int*"
-        CTCharStarStar -> "char**"
+        CEnum _ type_str -> type_str
         CPointer s -> ctypToStr s NoConst <> "*"
         CRef s -> ctypToStr s NoConst <> "*"
   in case isconst of
@@ -75,8 +103,11 @@
 char_ :: Types
 char_ = CT CTChar NoConst
 
+cshort_ :: Types
+cshort_ = CT CTShort Const
+
 short_ :: Types
-short_ = int_
+short_ = CT CTShort NoConst
 
 cdouble_ :: Types
 cdouble_ = CT CTDouble Const
@@ -85,10 +116,13 @@
 double_  = CT CTDouble NoConst
 
 doublep_ :: Types
-doublep_ = CT CTDoubleStar NoConst
+doublep_ = CT (CPointer CTDouble) NoConst
 
+cfloat_ :: Types
+cfloat_ = CT CTFloat Const
+
 float_ :: Types
-float_ = double_
+float_ = CT CTFloat NoConst
 
 bool_ :: Types
 bool_    = CT CTBool   NoConst
@@ -100,14 +134,14 @@
 voidp_ = CT CTVoidStar NoConst
 
 intp_ :: Types
-intp_ = CT CTIntStar NoConst
+intp_ = CT (CPointer CTInt) NoConst
 
 intref_ :: Types
 intref_ = CT (CRef CTInt) NoConst
 
 
 charpp_ :: Types
-charpp_ = CT CTCharStarStar NoConst
+charpp_ = CT (CPointer CTString) NoConst
 
 ref_ :: CTypes -> Types
 ref_ t = CT (CRef t) NoConst
@@ -154,8 +188,11 @@
 char :: String -> (Types,String)
 char var = (char_ , var)
 
+cshort :: String -> (Types,String)
+cshort var = (cshort_ , var)
+
 short :: String -> (Types,String)
-short = int
+short var = (short_ , var)
 
 cdouble :: String -> (Types,String)
 cdouble var = (cdouble_ , var)
@@ -166,8 +203,11 @@
 doublep :: String -> (Types,String)
 doublep var = (doublep_ , var)
 
+cfloat :: String -> (Types,String)
+cfloat var = (float_ , var)
+
 float :: String -> (Types,String)
-float = double
+float var = (float_ , var)
 
 bool :: String -> (Types,String)
 bool    var = (bool_    , var)
@@ -485,18 +525,46 @@
 
 -- |
 convertC2HS :: CTypes -> Type ()
-convertC2HS CTString     = tycon "CString"
-convertC2HS CTChar       = tycon "CChar"
-convertC2HS CTInt        = tycon "CInt"
-convertC2HS CTUInt       = tycon "CUInt"
-convertC2HS CTLong       = tycon "CLong"
-convertC2HS CTULong      = tycon "CULong"
-convertC2HS CTDouble     = tycon "CDouble"
-convertC2HS CTDoubleStar = tyapp (tycon "Ptr") (tycon "CDouble")
-convertC2HS CTBool       = tycon "CInt"
+convertC2HS CTBool      = tycon "CBool"
+convertC2HS CTChar      = tycon "CChar"
+convertC2HS CTClock     = tycon "CClock"
+convertC2HS CTDouble    = tycon "CDouble"
+convertC2HS CTFile      = tycon "CFile"
+convertC2HS CTFloat     = tycon "CFloat"
+convertC2HS CTFpos      = tycon "CFpos"
+convertC2HS CTInt       = tycon "CInt"
+convertC2HS CTIntMax    = tycon "CIntMax"
+convertC2HS CTIntPtr    = tycon "CIntPtr"
+convertC2HS CTJmpBuf    = tycon "CJmpBuf"
+convertC2HS CTLLong     = tycon "CLLong"
+convertC2HS CTLong      = tycon "CLong"
+convertC2HS CTPtrdiff   = tycon "CPtrdiff"
+convertC2HS CTSChar     = tycon "CSChar"
+convertC2HS CTSUSeconds = tycon "CSUSeconds"
+convertC2HS CTShort     = tycon "CShort"
+convertC2HS CTSigAtomic = tycon "CSigAtomic"
+convertC2HS CTSize      = tycon "CSize"
+convertC2HS CTTime      = tycon "CTime"
+convertC2HS CTUChar     = tycon "CUChar"
+convertC2HS CTUInt      = tycon "CUInt"
+convertC2HS CTUIntMax   = tycon "CUIntMax"
+convertC2HS CTUIntPtr   = tycon "CUIntPtr"
+convertC2HS CTULLong    = tycon "CULLong"
+convertC2HS CTULong     = tycon "CULong"
+convertC2HS CTUSeconds  = tycon "CUSeconds"
+convertC2HS CTUShort    = tycon "CUShort"
+convertC2HS CTWchar     = tycon "CWchar"
+convertC2HS CTInt8      = tycon "Int8"
+convertC2HS CTInt16      = tycon "Int16"
+convertC2HS CTInt32      = tycon "Int32"
+convertC2HS CTInt64      = tycon "Int64"
+convertC2HS CTUInt8      = tycon "Word8"
+convertC2HS CTUInt16      = tycon "Word16"
+convertC2HS CTUInt32      = tycon "Word32"
+convertC2HS CTUInt64      = tycon "Word64"
+convertC2HS CTString    = tycon "CString"
 convertC2HS CTVoidStar   = tyapp (tycon "Ptr") unit_tycon
-convertC2HS CTIntStar    = tyapp (tycon "Ptr") (tycon "CInt")
-convertC2HS CTCharStarStar = tyapp (tycon "Ptr") (tycon "CString")
+convertC2HS (CEnum t _)  = convertC2HS t
 convertC2HS (CPointer t) = tyapp (tycon "Ptr") (convertC2HS t)
 convertC2HS (CRef t)     = tyapp (tycon "Ptr") (convertC2HS t)
 
diff --git a/lib/FFICXX/Generate/Config.hs b/lib/FFICXX/Generate/Config.hs
--- a/lib/FFICXX/Generate/Config.hs
+++ b/lib/FFICXX/Generate/Config.hs
@@ -1,7 +1,7 @@
 -----------------------------------------------------------------------------
 -- |
 -- Module      : FFICXX.Generate.Config
--- Copyright   : (c) 2011-2013 Ian-Woo Kim
+-- Copyright   : (c) 2011-2019 Ian-Woo Kim
 --
 -- License     : BSD3
 -- Maintainer  : Ian-Woo Kim <ianwookim@gmail.com>
@@ -13,9 +13,27 @@
 
 module FFICXX.Generate.Config where
 
-data FFICXXConfig = FFICXXConfig { 
-  fficxxconfig_scriptBaseDir :: FilePath, 
-  fficxxconfig_workingDir :: FilePath, 
-  fficxxconfig_installBaseDir :: FilePath
-} deriving Show
+import FFICXX.Generate.Type.Cabal            ( Cabal )
+import FFICXX.Generate.Type.Class            ( Class, TemplateClass, TopLevelFunction )
+import FFICXX.Generate.Type.Config           ( ModuleUnitMap(..) )
+import FFICXX.Generate.Type.PackageInterface ( HeaderName )
 
+
+data FFICXXConfig = FFICXXConfig {
+    fficxxconfig_workingDir     :: FilePath
+  , fficxxconfig_installBaseDir :: FilePath
+  , fficxxconfig_staticFileDir  :: FilePath
+  } deriving Show
+
+data SimpleBuilderConfig =
+  SimpleBuilderConfig {
+    sbcTopModule     :: String
+  , sbcModUnitMap    :: ModuleUnitMap
+  , sbcCabal         :: Cabal
+  , sbcClasses       :: [Class]
+  , sbcTopLevels     :: [TopLevelFunction]
+  , sbcTemplates     :: [(TemplateClass,HeaderName)]
+  , sbcExtraLibs     :: [String]
+  , sbcExtraDeps     :: [(String,[String])]
+  , sbcStaticFiles   :: [String]
+  }
diff --git a/lib/FFICXX/Generate/ContentMaker.hs b/lib/FFICXX/Generate/ContentMaker.hs
--- a/lib/FFICXX/Generate/ContentMaker.hs
+++ b/lib/FFICXX/Generate/ContentMaker.hs
@@ -197,6 +197,13 @@
   \\n\
   \$alias\n\
   \\n\
+  \#define CHECKPROTECT(x,y) IS_PAREN(IS_ ## x ## _ ## y ## _PROTECTED)\n\
+  \\n\
+  \#define TYPECASTMETHOD(cname,mname,oname) \\\n\
+  \  IIF( CHECKPROTECT(cname,mname) ) ( \\\n\
+  \  (to_nonconst<oname,cname ## _t>), \\\n\
+  \  (to_nonconst<cname,cname ## _t>) )\n\
+  \\n\
   \$cppbody\n"
 
 
@@ -314,7 +321,11 @@
 buildFFIHsc m = mkModule (mname <.> "FFI") [lang ["ForeignFunctionInterface"]] ffiImports hscBody
   where mname = cmModule m
         headers = cmCIH m
-        ffiImports = [ mkImport "Foreign.C", mkImport "Foreign.Ptr", mkImport (mname <.> "RawType") ]
+        ffiImports = [ mkImport "Data.Word"
+                     , mkImport "Data.Int"
+                     , mkImport "Foreign.C"
+                     , mkImport "Foreign.Ptr"
+                     , mkImport (mname <.> "RawType") ]
                      <> genImportInFFI m
                      <> genExtraImport m
         hscBody = concatMap genHsFFI headers
@@ -344,6 +355,7 @@
                             ifaceImports ifaceBody
   where classes = cmClass m
         ifaceImports = [ mkImport "Data.Word"
+                       , mkImport "Data.Int"
                        , mkImport "Foreign.C"
                        , mkImport "Foreign.Ptr"
                        , mkImport "FFICXX.Runtime.Cast" ]
@@ -386,6 +398,7 @@
   where classes = cmClass m
         implImports = [ mkImport "Data.Monoid"                -- for template member
                       , mkImport "Data.Word"
+                      , mkImport "Data.Int"
                       , mkImport "Foreign.C"
                       , mkImport "Foreign.Ptr"
                       , mkImport "Language.Haskell.TH"        -- for template member
diff --git a/lib/FFICXX/Generate/Type/Cabal.hs b/lib/FFICXX/Generate/Type/Cabal.hs
--- a/lib/FFICXX/Generate/Type/Cabal.hs
+++ b/lib/FFICXX/Generate/Type/Cabal.hs
@@ -3,7 +3,7 @@
 -----------------------------------------------------------------------------
 -- |
 -- Module      : FFICXX.Generate.Type.Cabal
--- Copyright   : (c) 2011-2018 Ian-Woo Kim
+-- Copyright   : (c) 2011-2019 Ian-Woo Kim
 --
 -- License     : BSD3
 -- Maintainer  : Ian-Woo Kim <ianwookim@gmail.com>
@@ -29,22 +29,27 @@
 newtype CabalName = CabalName { unCabalName :: String }
                   deriving (Show,Eq,Ord)
 
+
+data BuildType = Simple
+               | Custom [CabalName] -- ^ dependencies
+
 -- TODO: change String to Text
 data Cabal =
        Cabal {
-         cabal_pkgname       :: CabalName
-       , cabal_version       :: String
-       , cabal_cheaderprefix :: String
-       , cabal_moduleprefix  :: String
-       , cabal_additional_c_incs :: [AddCInc]
-       , cabal_additional_c_srcs :: [AddCSrc]
+         cabal_pkgname            :: CabalName
+       , cabal_version            :: String
+       , cabal_cheaderprefix      :: String
+       , cabal_moduleprefix       :: String
+       , cabal_additional_c_incs  :: [AddCInc]
+       , cabal_additional_c_srcs  :: [AddCSrc]
        , cabal_additional_pkgdeps :: [CabalName]
-       , cabal_license          :: Maybe String
-       , cabal_licensefile      :: Maybe String
-       , cabal_extraincludedirs :: [FilePath]
-       , cabal_extralibdirs     :: [FilePath]
-       , cabal_extrafiles       :: [FilePath]
+       , cabal_license            :: Maybe String
+       , cabal_licensefile        :: Maybe String
+       , cabal_extraincludedirs   :: [FilePath]
+       , cabal_extralibdirs       :: [FilePath]
+       , cabal_extrafiles         :: [FilePath]
        , cabal_pkg_config_depends :: [String]
+       , cabal_buildType          :: BuildType
        }
 
 data GeneratedCabalInfo =
@@ -63,7 +68,7 @@
        , gci_extraFiles       :: [Text]
        , gci_csrcFiles        :: [Text]
        , gci_sourcerepository :: Text
-       , gci_ccOptions        :: [Text]
+       , gci_cxxOptions       :: [Text]
        , gci_pkgdeps          :: [Text]
        , gci_exposedModules   :: [Text]
        , gci_otherModules     :: [Text]
diff --git a/lib/FFICXX/Generate/Type/Class.hs b/lib/FFICXX/Generate/Type/Class.hs
--- a/lib/FFICXX/Generate/Type/Class.hs
+++ b/lib/FFICXX/Generate/Type/Class.hs
@@ -22,19 +22,48 @@
 --
 import           FFICXX.Generate.Type.Cabal
 
+
 -- | C types
-data CTypes = CTString
+data CTypes = CTBool
             | CTChar
+            | CTClock
+            | CTDouble
+            | CTFile
+            | CTFloat
+            | CTFpos
             | CTInt
-            | CTUInt
+            | CTIntMax
+            | CTIntPtr
+            | CTJmpBuf
+            | CTLLong
             | CTLong
+            | CTPtrdiff
+            | CTSChar
+            | CTSUSeconds
+            | CTShort
+            | CTSigAtomic
+            | CTSize
+            | CTTime
+            | CTUChar
+            | CTUInt
+            | CTUIntMax
+            | CTUIntPtr
+            | CTULLong
             | CTULong
-            | CTDouble
-            | CTBool
-            | CTDoubleStar
+            | CTUSeconds
+            | CTUShort
+            | CTWchar
+            | CTInt8
+            | CTInt16
+            | CTInt32
+            | CTInt64
+            | CTUInt8
+            | CTUInt16
+            | CTUInt32
+            | CTUInt64
             | CTVoidStar
-            | CTIntStar
-            | CTCharStarStar
+            | CTString
+            | CEnum CTypes String
             | CPointer CTypes
             | CRef CTypes
             deriving Show
