diff --git a/bindings-common.cabal b/bindings-common.cabal
--- a/bindings-common.cabal
+++ b/bindings-common.cabal
@@ -4,12 +4,12 @@
 synopsis:
   Low-level library bindings, base package.
 description: 
-  The @bindings-*@ set of packages contain low level bindings
+  The @bindings-*@ set of packages contains low level bindings
   for established libraries, and is aimed at developers of higher
   level modules that can use it as foundation. They all mimic the
-  exact names and functionality of the original libraries. For
+  names and functionality of the original libraries. For
   a specific library, look for package @bindings-library_name@.
-version: 0.1.4
+version: 0.2
 license: BSD3
 license-file: LICENSE
 maintainer: Maurício C. Antunes
@@ -18,13 +18,11 @@
 category: FFI
 library
   hs-source-dirs: src
-  c-sources:
-    src/ctypes.c
-    src/cfunctions.c
-    src/cconstants.c
+  include-dirs: src
+  install-includes:
+    bindings.macros.h
   extensions:
     ForeignFunctionInterface
-    TypeSynonymInstances
     ScopedTypeVariables
     MultiParamTypeClasses
     TypeFamilies
@@ -33,7 +31,3 @@
     Bindings
     Bindings.Utilities
     Bindings.C
-  other-modules:
-    CFunctions
-    CConstants
-    CTypes
diff --git a/src/Bindings/C.hs b/src/Bindings/C.hs
deleted file mode 100644
--- a/src/Bindings/C.hs
+++ /dev/null
@@ -1,26 +0,0 @@
-module Bindings.C (
-
-    -- * @time.h@
-
-    -- | <http://www.cplusplus.com/reference/clibrary/ctime>
-
-    clock,
-    difftime,
-    mktime,
-    time,
-    asctime,
-    ctime,
-    gmtime,
-    localtime,
-    strftime,
-    _CLOCKS_PER_SEC,
-    Tm,
-
-    -- * @sys/time.h@
-
-    Timeval,
-
- ) where
-import CFunctions
-import CTypes
-import CConstants
diff --git a/src/Bindings/C.hsc b/src/Bindings/C.hsc
new file mode 100644
--- /dev/null
+++ b/src/Bindings/C.hsc
@@ -0,0 +1,699 @@
+#include <bindings.macros.h>
+
+#bindings_initialize _
+
+module Bindings.C (
+
+  -- * @ctype.h@
+
+  -- | http://www.opengroup.org/onlinepubs/9699919799/basedefs/ctype.h.html
+
+  #bindings_export_varids isalnum|isalpha|isblank|iscntrl|isdigit
+  #bindings_export_varids isgraph|islower|isprint|ispunct|isspace
+  #bindings_export_varids isupper|isxdigit|tolower|toupper
+
+  -- * @errno.h@
+
+  -- | http://www.opengroup.org/onlinepubs/9699919799/basedefs/errno.h.html
+
+  #bindings_export_varids EDOM|EILSEQ|ERANGE
+
+  -- * @locale.h@
+
+  -- | http://www.opengroup.org/onlinepubs/9699919799/basedefs/locale.h.html
+
+  #bindings_export_conids lconv
+
+  #bindings_export_varids LC_ALL|LC_COLLATE|LC_CTYPE
+  #bindings_export_varids LC_MONETARY|LC_NUMERIC|LC_TIME
+
+  #bindings_export_varids localeconv|setlocale
+
+  -- * @math.h@
+
+  -- | http://www.opengroup.org/onlinepubs/9699919799/basedefs/math.h.html
+
+  #bindings_export_varids acos|acosf|acosl|acosh|acoshf
+  #bindings_export_varids acoshl|asin|asinf|asinl|asinh
+  #bindings_export_varids asinhf|asinhl|atan|atanf|atanl
+  #bindings_export_varids atan2|atan2f|atan2l|atanh|atanhf
+  #bindings_export_varids atanhl|cbrt|cbrtf|cbrtl|ceil
+  #bindings_export_varids ceilf|ceill|copysign|copysignf
+  #bindings_export_varids copysignl|cos|cosf|cosl|cosh
+  #bindings_export_varids coshf|coshl|erf|erff|erfl|erfc
+  #bindings_export_varids erfcf|erfcl|exp|expf|expl
+  #bindings_export_varids exp2|exp2f|exp2l|expm1|expm1f
+  #bindings_export_varids expm1l|fabs|fabsf|fabsl|fdim
+  #bindings_export_varids fdimf|fdiml|floor|floorf
+  #bindings_export_varids floorl|fma|fmaf|fmal|fmax
+  #bindings_export_varids fmaxf|fmaxl|fmin|fminf|fminl
+  #bindings_export_varids fmod|fmodf|fmodl|frexp|frexpf
+  #bindings_export_varids frexpl|hypot|hypotf|hypotl
+  #bindings_export_varids ilogb|ilogbf|ilogbl|ldexp
+  #bindings_export_varids ldexpf|ldexpl|lgamma|lgammaf
+  #bindings_export_varids lgammal|llrint|llrintf|llrintl
+  #bindings_export_varids llround|llroundf|llroundl|log
+  #bindings_export_varids logf|logl|log10|log10f|log10l
+  #bindings_export_varids log1p|log1pf|log1pl|log2
+  #bindings_export_varids log2f|log2l|logb|logbf|logbl
+  #bindings_export_varids lrint|lrintf|lrintl|lround
+  #bindings_export_varids lroundf|lroundl|modf|modff
+  #bindings_export_varids modfl|nan|nanf|nanl|nearbyint
+  #bindings_export_varids nearbyintf|nearbyintl|nextafter
+  #bindings_export_varids nextafterf|nextafterl|nexttoward
+  #bindings_export_varids nexttowardf|nexttowardl|pow
+  #bindings_export_varids powf|powl|remainder|remainderf
+  #bindings_export_varids remainderl|remquo|remquof
+  #bindings_export_varids remquol|rint|rintf|rintl
+  #bindings_export_varids round|roundf|roundl|scalbln
+  #bindings_export_varids scalblnf|scalblnl|scalbn|scalbnf
+  #bindings_export_varids scalbnl|sin|sinf|sinl|sinh|sinhf
+  #bindings_export_varids sinhl|sqrt|sqrtf|sqrtl|tan
+  #bindings_export_varids tanf|tanl|tanh|tanhf|tanhl
+  #bindings_export_varids tgamma|tgammaf|tgammal|trunc
+  #bindings_export_varids truncf|truncl
+
+  -- * @signal.h@
+
+  -- | http://www.opengroup.org/onlinepubs/9699919799/basedefs/signal.h.html
+
+  #bindings_export_varids SIG_DFL|SIG_ERR|SIG_IGN
+  #bindings_export_varids SIGINT|SIGILL|SIGABRT
+  #bindings_export_varids SIGFPE|SIGSEGV|SIGTERM
+
+  #bindings_export_varids raise|signal
+
+  -- * @stdbool.h@
+
+  -- | http://www.opengroup.org/onlinepubs/9699919799/basedefs/stdbool.h.html
+
+  -- * @stddef.h@
+
+  -- | http://www.opengroup.org/onlinepubs/9699919799/basedefs/stddef.h.html
+
+  #bindings_export_varids NULL
+
+  -- * @stdint.h@
+
+  -- | http://www.opengroup.org/onlinepubs/9699919799/basedefs/stdint.h.html
+
+  -- * @stdio.h@
+
+  -- | http://www.opengroup.org/onlinepubs/9699919799/basedefs/stdio.h.html
+
+  #bindings_export_varids BUFSIZ|_IOFBF|_IOLBF|_IONBF
+  #bindings_export_varids SEEK_CUR|SEEK_END|SEEK_SET|FILENAME_MAX
+  #bindings_export_varids FOPEN_MAX|EOF
+
+  #bindings_export_varids clearerr|fclose|feof|ferror
+  #bindings_export_varids fflush|fgetc|fgetpos|fgets
+  #bindings_export_varids fopen|fputc|fputs|fread
+  #bindings_export_varids freopen|fseek|fsetpos|ftell
+  #bindings_export_varids fwrite|getc|getchar|perror
+  #bindings_export_varids putc|putchar|puts|remove
+  #bindings_export_varids rename|rewind|setbuf|setvbuf
+  #bindings_export_varids tmpfile|ungetc
+
+  -- * @stdlib.h@
+
+  -- | http://www.opengroup.org/onlinepubs/9699919799/basedefs/stdlib.h.html
+
+  #bindings_export_varids EXIT_FAILURE|EXIT_SUCCESS|RAND_MAX|MB_CUR_MAX
+
+  #bindings_export_varids _Exit|abort|abs|atexit
+  #bindings_export_varids atof|atoi|atol|atoll
+  #bindings_export_varids bsearch|calloc|exit|free
+  #bindings_export_varids getenv|getsubopt|labs|llabs
+  #bindings_export_varids malloc|mblen|mbstowcs|mbtowc
+  #bindings_export_varids qsort|rand|realloc|srand
+  #bindings_export_varids strtod|strtof|strtol|strtold
+  #bindings_export_varids strtoll|strtoul|strtoull|system
+  #bindings_export_varids wcstombs|wctomb
+
+  -- * @string.h@
+
+  -- | http://www.opengroup.org/onlinepubs/9699919799/basedefs/string.h.html
+
+  -- * @time.h@
+
+  -- | http://www.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html
+
+  #bindings_export_conids tm
+
+  #bindings_export_varids TIMER_ABSTIME
+
+  #bindings_export_varids clock|difftime|gmtime|localtime
+  #bindings_export_varids mktime|strftime|time
+
+  -- * @wchar.h@
+
+  -- | http://www.opengroup.org/onlinepubs/9699919799/basedefs/wchar.h.html
+
+  #bindings_export_conids mbstate_t
+
+  CWint,
+
+  #bindings_export_varids WEOF
+
+  #bindings_export_varids btowc|fgetwc|fgetws|fputwc|fputws
+  #bindings_export_varids fwide|getwc|getwchar|mbrlen
+  #bindings_export_varids mbrtowc|mbsinit|mbsrtowcs|putwchar
+  #bindings_export_varids putwc|ungetwc|wcrtomb|wcscat
+  #bindings_export_varids wcschr|wcscmp|wcscoll|wcscpy
+  #bindings_export_varids wcscspn|wcsftime|wcslen|wcsncat
+  #bindings_export_varids wcsncmp|wcsncpy|wcspbrk|wcsrchr
+  #bindings_export_varids wcsrtombs|wcsspn|wcsstr|wcstod
+  #bindings_export_varids wcstof|wcstok|wcstold|wcstoll
+  #bindings_export_varids wcstol|wcstoull|wcstoul|wcsxfrm
+  #bindings_export_varids wctob|wmemchr|wmemcmp|wmemcpy
+  #bindings_export_varids wmemmove|wmemset
+
+  -- * @wctype.h@
+
+  -- | http://www.opengroup.org/onlinepubs/9699919799/basedefs/wctype.h.html
+
+  CWctrans,CWctype,
+
+  #bindings_export_varids iswalnum|iswalpha|iswblank|  \
+    iswcntrl|iswctype|iswdigit|iswgraph|iswlower|  \
+    iswprint|iswpunct|iswspace|iswupper|iswxdigit|  \
+    towctrans|towlower|towupper|wctrans|wctype
+
+
+
+
+ ) where
+
+import Prelude (($),Monad(..),IO(..),Num)
+import Foreign hiding (free,malloc,realloc)
+import Foreign.C
+
+#include <ctype.h>
+
+#bindings_function isalnum , CInt -> IO CInt
+#bindings_function isalpha , CInt -> IO CInt
+#bindings_function isblank , CInt -> IO CInt
+#bindings_function iscntrl , CInt -> IO CInt
+#bindings_function isdigit , CInt -> IO CInt
+#bindings_function isgraph , CInt -> IO CInt
+#bindings_function islower , CInt -> IO CInt
+#bindings_function isprint , CInt -> IO CInt
+#bindings_function ispunct , CInt -> IO CInt
+#bindings_function isspace , CInt -> IO CInt
+#bindings_function isupper , CInt -> IO CInt
+#bindings_function isxdigit , CInt -> IO CInt
+#bindings_function tolower , CInt -> IO CInt
+#bindings_function toupper , CInt -> IO CInt
+
+#include <errno.h>
+
+#bindings_int EDOM
+#bindings_int EILSEQ
+#bindings_int ERANGE
+
+#include <locale.h>
+
+#bindings_function localeconv , IO (Ptr Lconv)
+#bindings_function setlocale , CInt -> CString -> IO CString
+
+#bindings_starttype struct lconv
+#bindings_field currency_symbol , CString
+#bindings_field decimal_point , CString
+#bindings_field frac_digits , CChar
+#bindings_field grouping , CString
+#bindings_field int_curr_symbol , CString
+#bindings_field int_frac_digits , CChar
+-- #bindings_field int_n_cs_precedes , CChar
+-- #bindings_field int_n_sep_by_space , CChar
+-- #bindings_field int_n_sign_posn , CChar
+-- #bindings_field int_p_cs_precedes , CChar
+-- #bindings_field int_p_sep_by_space , CChar
+-- #bindings_field int_p_sign_posn , CChar
+#bindings_field mon_decimal_point , CString
+#bindings_field mon_grouping , CString
+#bindings_field mon_thousands_sep , CString
+#bindings_field negative_sign , CString
+#bindings_field n_cs_precedes , CChar
+#bindings_field n_sep_by_space , CChar
+#bindings_field n_sign_posn , CChar
+#bindings_field positive_sign , CString
+#bindings_field p_cs_precedes , CChar
+#bindings_field p_sep_by_space , CChar
+#bindings_field p_sign_posn , CChar
+#bindings_field thousands_sep , CString
+#bindings_stoptype _
+
+#bindings_int LC_ALL
+#bindings_int LC_COLLATE
+#bindings_int LC_CTYPE
+#bindings_int LC_MONETARY
+#bindings_int LC_NUMERIC
+#bindings_int LC_TIME
+
+#include <math.h>
+
+-- #bindings_double HUGE_VAL
+
+#bindings_function acos , CDouble -> IO CDouble
+#bindings_function acosf , CFloat -> IO CFloat
+#bindings_function acosl , CLDouble -> IO CLDouble
+#bindings_function acosh , CDouble -> IO CDouble
+#bindings_function acoshf , CFloat -> IO CFloat
+#bindings_function acoshl , CLDouble -> IO CLDouble
+#bindings_function asin , CDouble -> IO CDouble
+#bindings_function asinf , CFloat -> IO CFloat
+#bindings_function asinl , CLDouble -> IO CLDouble
+#bindings_function asinh , CDouble -> IO CDouble
+#bindings_function asinhf , CFloat -> IO CFloat
+#bindings_function asinhl , CLDouble -> IO CLDouble
+#bindings_function atan , CDouble -> IO CDouble
+#bindings_function atanf , CFloat -> IO CFloat
+#bindings_function atanl , CLDouble -> IO CLDouble
+#bindings_function atan2 , CDouble -> CDouble -> IO CDouble
+#bindings_function atan2f , CFloat -> CFloat -> IO CFloat
+#bindings_function atan2l , CLDouble -> CLDouble -> IO CLDouble
+#bindings_function atanh , CDouble -> IO CDouble
+#bindings_function atanhf , CFloat -> IO CFloat
+#bindings_function atanhl , CLDouble -> IO CLDouble
+#bindings_function cbrt , CDouble -> IO CDouble
+#bindings_function cbrtf , CFloat -> IO CFloat
+#bindings_function cbrtl , CLDouble -> IO CLDouble
+#bindings_function ceil , CDouble -> IO CDouble
+#bindings_function ceilf , CFloat -> IO CFloat
+#bindings_function ceill , CLDouble -> IO CLDouble
+#bindings_function copysign , CDouble -> CDouble -> IO CDouble
+#bindings_function copysignf , CFloat -> CFloat -> IO CFloat
+#bindings_function copysignl , CLDouble -> CLDouble -> IO CLDouble
+#bindings_function cos , CDouble -> IO CDouble
+#bindings_function cosf , CFloat -> IO CFloat
+#bindings_function cosl , CLDouble -> IO CLDouble
+#bindings_function cosh , CDouble -> IO CDouble
+#bindings_function coshf , CFloat -> IO CFloat
+#bindings_function coshl , CLDouble -> IO CLDouble
+#bindings_function erf , CDouble -> IO CDouble
+#bindings_function erff , CFloat -> IO CFloat
+#bindings_function erfl , CLDouble -> IO CLDouble
+#bindings_function erfc , CDouble -> IO CDouble
+#bindings_function erfcf , CFloat -> IO CFloat
+#bindings_function erfcl , CLDouble -> IO CLDouble
+#bindings_function exp , CDouble -> IO CDouble
+#bindings_function expf , CFloat -> IO CFloat
+#bindings_function expl , CLDouble -> IO CLDouble
+#bindings_function exp2 , CDouble -> IO CDouble
+#bindings_function exp2f , CFloat -> IO CFloat
+#bindings_function exp2l , CLDouble -> IO CLDouble
+#bindings_function expm1 , CDouble -> IO CDouble
+#bindings_function expm1f , CFloat -> IO CFloat
+#bindings_function expm1l , CLDouble -> IO CLDouble
+#bindings_function fabs , CDouble -> IO CDouble
+#bindings_function fabsf , CFloat -> IO CFloat
+#bindings_function fabsl , CLDouble -> IO CLDouble
+#bindings_function fdim , CDouble -> CDouble -> IO CDouble
+#bindings_function fdimf , CFloat -> CFloat -> IO CFloat
+#bindings_function fdiml , CLDouble -> CLDouble -> IO CLDouble
+#bindings_function floor , CDouble -> IO CDouble
+#bindings_function floorf , CFloat -> IO CFloat
+#bindings_function floorl , CLDouble -> IO CLDouble
+#bindings_function fma , CDouble -> CDouble -> CDouble -> IO CDouble
+#bindings_function fmaf , CFloat -> CFloat -> CFloat -> IO CFloat
+#bindings_function fmal , CLDouble -> CLDouble -> CLDouble -> IO CLDouble
+#bindings_function fmax , CDouble -> CDouble -> IO CDouble
+#bindings_function fmaxf , CFloat -> CFloat -> IO CFloat
+#bindings_function fmaxl , CLDouble -> CLDouble -> IO CLDouble
+#bindings_function fmin , CDouble -> CDouble -> IO CDouble
+#bindings_function fminf , CFloat -> CFloat -> IO CFloat
+#bindings_function fminl , CLDouble -> CLDouble -> IO CLDouble
+#bindings_function fmod , CDouble -> CDouble -> IO CDouble
+#bindings_function fmodf , CFloat -> CFloat -> IO CFloat
+#bindings_function fmodl , CLDouble -> CLDouble -> IO CLDouble
+#bindings_function frexp , CDouble -> Ptr CInt -> IO CDouble
+#bindings_function frexpf , CFloat -> Ptr CInt -> IO CFloat
+#bindings_function frexpl , CLDouble -> Ptr CInt -> IO CLDouble
+#bindings_function hypot , CDouble -> CDouble -> IO CDouble
+#bindings_function hypotf , CFloat -> CFloat -> IO CFloat
+#bindings_function hypotl , CLDouble -> CLDouble -> IO CLDouble
+#bindings_function ilogb , CDouble -> IO CDouble
+#bindings_function ilogbf , CFloat -> IO CFloat
+#bindings_function ilogbl , CLDouble -> IO CLDouble
+#bindings_function ldexp , CDouble -> CInt -> IO CDouble
+#bindings_function ldexpf , CFloat -> CInt -> IO CFloat
+#bindings_function ldexpl , CLDouble -> CInt -> IO CLDouble
+#bindings_function lgamma , CDouble -> IO CDouble
+#bindings_function lgammaf , CFloat -> IO CFloat
+#bindings_function lgammal , CLDouble -> IO CLDouble
+#bindings_function llrint , CDouble -> IO CLLong
+#bindings_function llrintf , CFloat -> IO CLLong
+#bindings_function llrintl , CLDouble -> IO CLLong
+#bindings_function llround , CDouble -> IO CLLong
+#bindings_function llroundf , CFloat -> IO CLLong
+#bindings_function llroundl , CLDouble -> IO CLLong
+#bindings_function log , CDouble -> IO CDouble
+#bindings_function logf , CFloat -> IO CFloat
+#bindings_function logl , CLDouble -> IO CLDouble
+#bindings_function log10 , CDouble -> IO CDouble
+#bindings_function log10f , CFloat -> IO CFloat
+#bindings_function log10l , CLDouble -> IO CLDouble
+#bindings_function log1p , CDouble -> IO CDouble
+#bindings_function log1pf , CFloat -> IO CFloat
+#bindings_function log1pl , CLDouble -> IO CLDouble
+#bindings_function log2 , CDouble -> IO CDouble
+#bindings_function log2f , CFloat -> IO CFloat
+#bindings_function log2l , CLDouble -> IO CLDouble
+#bindings_function logb , CDouble -> IO CDouble
+#bindings_function logbf , CFloat -> IO CFloat
+#bindings_function logbl , CLDouble -> IO CLDouble
+#bindings_function lrint , CDouble -> IO CLong
+#bindings_function lrintf , CFloat -> IO CLong
+#bindings_function lrintl , CLDouble -> IO CLong
+#bindings_function lround , CDouble -> IO CLong
+#bindings_function lroundf , CFloat -> IO CLong
+#bindings_function lroundl , CLDouble -> IO CLong
+#bindings_function modf , CDouble -> Ptr CDouble -> IO CDouble
+#bindings_function modff , CFloat -> Ptr CFloat -> IO CFloat
+#bindings_function modfl , CLDouble -> Ptr CLDouble -> IO CLDouble
+#bindings_function nan , CString -> IO CDouble
+#bindings_function nanf , CString -> IO CFloat
+#bindings_function nanl , CString -> IO CLDouble
+#bindings_function nearbyint , CDouble -> IO CDouble
+#bindings_function nearbyintf , CFloat -> IO CFloat
+#bindings_function nearbyintl , CLDouble -> IO CLDouble
+#bindings_function nextafter , CDouble -> CDouble -> IO CDouble
+#bindings_function nextafterf , CFloat -> CFloat -> IO CFloat
+#bindings_function nextafterl , CLDouble -> CLDouble -> IO CLDouble
+#bindings_function nexttoward , CDouble -> CLDouble -> IO CDouble
+#bindings_function nexttowardf , CFloat -> CLDouble -> IO CFloat
+#bindings_function nexttowardl , CLDouble -> CLDouble -> IO CLDouble
+#bindings_function pow , CDouble -> CDouble -> IO CDouble
+#bindings_function powf , CFloat -> CFloat -> IO CFloat
+#bindings_function powl , CLDouble -> CLDouble -> IO CLDouble
+#bindings_function remainder , CDouble -> CDouble -> IO CDouble
+#bindings_function remainderf , CFloat -> CFloat -> IO CFloat
+#bindings_function remainderl , CLDouble -> CLDouble -> IO CLDouble
+#bindings_function remquo , CDouble -> CDouble -> Ptr CInt -> CDouble
+#bindings_function remquof , CFloat -> CFloat -> Ptr CInt -> CFloat
+#bindings_function remquol , CLDouble -> CLDouble -> Ptr CInt -> CLDouble
+#bindings_function rint , CDouble -> IO CDouble
+#bindings_function rintf , CFloat -> IO CFloat
+#bindings_function rintl , CLDouble -> IO CLDouble
+#bindings_function round , CDouble -> IO CDouble
+#bindings_function roundf , CFloat -> IO CFloat
+#bindings_function roundl , CLDouble -> IO CLDouble
+#bindings_function scalbln , CDouble -> CLong -> IO CDouble
+#bindings_function scalblnf , CFloat -> CLong -> IO CFloat
+#bindings_function scalblnl , CLDouble -> CLong -> IO CLDouble
+#bindings_function scalbn , CDouble -> CInt -> IO CDouble
+#bindings_function scalbnf , CFloat -> CInt -> IO CFloat
+#bindings_function scalbnl , CLDouble -> CInt -> IO CLDouble
+#bindings_function sin , CDouble -> IO CDouble
+#bindings_function sinf , CFloat -> IO CFloat
+#bindings_function sinl , CLDouble -> IO CLDouble
+#bindings_function sinh , CDouble -> IO CDouble
+#bindings_function sinhf , CFloat -> IO CFloat
+#bindings_function sinhl , CLDouble -> IO CLDouble
+#bindings_function sqrt , CDouble -> IO CDouble
+#bindings_function sqrtf , CFloat -> IO CFloat
+#bindings_function sqrtl , CLDouble -> IO CLDouble
+#bindings_function tan , CDouble -> IO CDouble
+#bindings_function tanf , CFloat -> IO CFloat
+#bindings_function tanl , CLDouble -> IO CLDouble
+#bindings_function tanh , CDouble -> IO CDouble
+#bindings_function tanhf , CFloat -> IO CFloat
+#bindings_function tanhl , CLDouble -> IO CLDouble
+#bindings_function tgamma , CDouble -> IO CDouble
+#bindings_function tgammaf , CFloat -> IO CFloat
+#bindings_function tgammal , CLDouble -> IO CLDouble
+#bindings_function trunc , CDouble -> IO CDouble
+#bindings_function truncf , CFloat -> IO CFloat
+#bindings_function truncl , CLDouble -> IO CLDouble
+
+#include <signal.h>
+
+#bindings_funptr SIG_DFL , FunPtr (CInt -> IO ())
+#bindings_funptr SIG_ERR , FunPtr (CInt -> IO ())
+#bindings_funptr SIG_IGN , FunPtr (CInt -> IO ())
+
+#bindings_int SIGINT
+#bindings_int SIGILL
+#bindings_int SIGABRT
+#bindings_int SIGFPE
+#bindings_int SIGSEGV
+#bindings_int SIGTERM
+
+#bindings_function raise , CInt -> IO CInt
+#bindings_function signal , CInt -> IO (FunPtr (CInt -> (CInt -> IO ())))
+
+#include <stddef.h>
+
+#bindings_ptr NULL , Ptr a
+
+#include <stdio.h>
+
+#bindings_num BUFSIZ
+#bindings_num _IOFBF
+#bindings_num _IOLBF
+#bindings_num _IONBF
+#bindings_num SEEK_CUR
+#bindings_num SEEK_END
+#bindings_num SEEK_SET
+#bindings_num FILENAME_MAX
+#bindings_num FOPEN_MAX
+#bindings_int EOF
+-- #bindings_ptr stderr , Ptr CFile
+-- #bindings_ptr stdin , Ptr CFile
+-- #bindings_ptr stdout , Ptr CFile
+
+#bindings_function clearerr , Ptr CFile -> IO ()
+#bindings_function fclose , Ptr CFile -> IO CInt
+#bindings_function feof , Ptr CFile -> IO CInt
+#bindings_function ferror , Ptr CFile -> IO CInt
+#bindings_function fflush , Ptr CFile -> IO CInt
+#bindings_function fgetc , Ptr CFile -> IO CInt
+#bindings_function fgetpos , Ptr CFile -> Ptr CFpos -> IO CInt
+#bindings_function fgets , CString -> CInt -> Ptr CFile -> IO CString
+#bindings_function fopen , CString -> CString -> IO (Ptr CFile)
+#bindings_function fputc , CInt -> Ptr CFile -> IO CInt
+#bindings_function fputs , CString -> Ptr CFile -> IO CInt
+#bindings_function fread , Ptr () -> CSize -> CSize -> \
+  Ptr CFile -> IO CSize
+#bindings_function freopen , CString -> CString -> \
+  Ptr CFile -> IO (Ptr CFile)
+#bindings_function fseek , Ptr CFile -> CLong -> CInt -> IO CInt
+#bindings_function fsetpos , Ptr CFile -> Ptr CFpos -> IO CInt
+#bindings_function ftell , Ptr CFile -> IO CLong
+#bindings_function fwrite , Ptr () -> CSize -> CSize -> \
+  Ptr CFile -> IO CSize
+#bindings_function getc , Ptr CFile -> IO CInt
+#bindings_function getchar , IO CInt
+#bindings_function perror , CString -> IO ()
+#bindings_function putc , CInt -> Ptr CFile -> IO CInt
+#bindings_function putchar , CInt -> IO CInt
+#bindings_function puts , CString -> IO CInt
+#bindings_function remove , CString -> IO CInt
+#bindings_function rename , CString -> CString -> IO CInt
+#bindings_function rewind , Ptr CFile -> IO ()
+#bindings_function setbuf , Ptr CFile -> CString -> IO ()
+#bindings_function setvbuf , Ptr CFile -> CString -> \
+  CInt -> CSize -> IO CInt
+#bindings_function tmpfile , IO (Ptr CFile)
+#bindings_function ungetc , CInt -> Ptr CFile -> IO CInt
+
+#include <stdlib.h>
+
+#bindings_num EXIT_FAILURE
+#bindings_num EXIT_SUCCESS
+#bindings_num RAND_MAX
+#bindings_size MB_CUR_MAX
+
+#bindings_function _Exit , CInt -> IO ()
+#bindings_function abort , IO ()
+#bindings_function abs , CInt -> IO CInt
+#bindings_function atexit , FunPtr (IO ()) -> IO CInt
+#bindings_function atof , CString -> IO CDouble
+#bindings_function atoi , CString -> IO CInt
+#bindings_function atol , CString -> IO CLong
+#bindings_function atoll , CString -> IO CLLong
+#bindings_function bsearch , Ptr a -> Ptr a -> CSize -> CSize -> \
+  FunPtr (Ptr a -> Ptr a -> IO CInt) -> IO (Ptr a)
+#bindings_function calloc , CSize -> CSize -> IO (Ptr ())
+#bindings_function exit , CInt -> IO ()
+#bindings_function free , Ptr () -> IO ()
+#bindings_function getenv , CString -> IO CString
+#bindings_function getsubopt , Ptr CString -> Ptr CString -> \
+  Ptr CString -> IO CInt
+#bindings_function labs , CLong -> IO CLong
+#bindings_function llabs , CLLong -> IO CLLong
+#bindings_function malloc , CSize -> IO (Ptr ())
+#bindings_function mblen , CString -> CSize -> IO CInt
+#bindings_function mbstowcs , Ptr CWchar -> CString -> \
+  CSize -> IO CSize
+#bindings_function mbtowc , Ptr CWchar -> CString -> \
+  CSize -> IO CInt
+#bindings_function qsort , Ptr a -> CSize -> CSize -> \
+  FunPtr (Ptr a -> Ptr a -> IO CInt) -> IO ()
+#bindings_function rand , IO CInt
+#bindings_function realloc , Ptr () -> CSize -> IO (Ptr ())
+#bindings_function srand , CUInt -> IO ()
+#bindings_function strtod , CString -> Ptr CString -> IO CDouble
+#bindings_function strtof , CString -> Ptr CString -> IO CFloat
+#bindings_function strtol , CString -> Ptr CString -> \
+  CInt -> IO CLong
+#bindings_function strtold , CString -> Ptr CString -> \
+  IO CLDouble
+#bindings_function strtoll , CString -> Ptr CString -> \
+  CInt -> IO CLLong
+#bindings_function strtoul , CString -> Ptr CString -> \
+  CInt -> Ptr CULong
+#bindings_function strtoull , CString -> Ptr CString -> \
+  CInt -> IO CULLong
+#bindings_function system , CString -> IO CInt
+#bindings_function wcstombs , CString -> Ptr CWchar -> \
+  CSize -> IO CSize
+#bindings_function wctomb , CString -> CWchar -> IO CInt
+
+#include <time.h>
+
+#bindings_starttype struct tm
+#bindings_field tm_sec , CInt
+#bindings_field tm_min , CInt
+#bindings_field tm_hour , CInt
+#bindings_field tm_mday , CInt
+#bindings_field tm_mon , CInt
+#bindings_field tm_year , CInt
+#bindings_field tm_wday , CInt
+#bindings_field tm_yday , CInt
+#bindings_field tm_isdst , CInt
+#bindings_stoptype _
+
+#bindings_function clock , IO CClock
+#bindings_function difftime , CTime -> CTime -> IO CDouble
+#bindings_function gmtime , Ptr CTime -> IO (Ptr Tm)
+#bindings_function localtime , Ptr CTime -> IO (Ptr Tm)
+#bindings_function mktime , Ptr Tm -> IO CTime
+#bindings_function strftime , CString -> CSize -> CString -> \
+  Ptr Tm -> IO CSize
+#bindings_function time , Ptr CTime -> IO CTime
+
+-- #bindings_clock CLOCKS_PER_SEC
+#bindings_num TIMER_ABSTIME
+
+#include <wchar.h>
+
+#bindings_starttype mbstate_t
+#bindings_stoptype _
+
+type CWint = #bindings_equivalent_integer wint_t
+
+#bindings_integer_like WEOF , CWint
+
+#bindings_function btowc , CInt -> IO CWint
+#bindings_function fgetwc , Ptr CFile -> IO CWint
+#bindings_function fgetws , Ptr CWchar -> CInt -> \
+  Ptr CFile -> IO (Ptr CWchar)
+#bindings_function fputwc , CWchar -> Ptr CFile -> \
+  IO CWint
+#bindings_function fputws , Ptr CWchar -> Ptr CFile -> \
+  IO CInt
+#bindings_function fwide , Ptr CFile -> CInt -> \
+  IO CInt
+#bindings_function getwc , Ptr CFile -> IO CWint
+#bindings_function getwchar , IO CWint
+#bindings_function mbrlen , CString -> CSize -> \
+  Ptr Mbstate_t -> IO CSize
+#bindings_function mbrtowc , Ptr CWchar -> CString -> \
+  CSize -> Ptr Mbstate_t -> IO CSize
+#bindings_function mbsinit , Ptr Mbstate_t -> IO CInt
+#bindings_function mbsrtowcs , Ptr CWchar -> Ptr CString -> \
+  CSize -> Ptr Mbstate_t -> IO CSize
+#bindings_function putwchar , CWchar -> IO CWint
+#bindings_function putwc , CWchar -> Ptr CFile -> \
+  IO CWint
+#bindings_function ungetwc , CWint -> Ptr CFile -> \
+  IO CWint
+#bindings_function wcrtomb , CString -> CWchar -> \
+  Ptr Mbstate_t -> IO CSize
+#bindings_function wcscat , Ptr CWchar -> Ptr CWchar -> \
+  IO CWchar
+#bindings_function wcschr , Ptr CWchar -> CWchar -> \
+  IO CWchar
+#bindings_function wcscmp , Ptr CWchar -> Ptr CWchar -> \
+  IO CInt
+#bindings_function wcscoll , Ptr CWchar -> Ptr CWchar -> \
+  IO CInt
+#bindings_function wcscpy , Ptr CWchar -> Ptr CWchar -> \
+  IO (Ptr CWchar)
+#bindings_function wcscspn , Ptr CWchar -> Ptr CWchar -> \
+  IO CSize
+#bindings_function wcsftime , Ptr CWchar -> CSize -> \
+  Ptr CWchar -> Ptr Tm -> IO CSize
+#bindings_function wcslen , Ptr CWchar -> IO CSize
+#bindings_function wcsncat , Ptr CWchar -> Ptr CWchar -> \
+  CSize -> IO (Ptr CWchar)
+#bindings_function wcsncmp , Ptr CWchar -> Ptr CWchar -> \
+  CSize -> IO CInt
+#bindings_function wcsncpy , Ptr CWchar -> Ptr CWchar -> \
+  CSize -> IO (Ptr CWchar)
+#bindings_function wcspbrk , Ptr CWchar -> Ptr CWchar -> \
+  IO (Ptr CWchar)
+#bindings_function wcsrchr , Ptr CWchar -> CWchar -> \
+  IO (Ptr CWchar)
+#bindings_function wcsrtombs , CString -> Ptr (Ptr CWchar) -> \
+  CSize -> Ptr Mbstate_t -> IO CSize
+#bindings_function wcsspn , Ptr CWchar -> Ptr CWchar -> \
+  IO CSize
+#bindings_function wcsstr , Ptr CWchar -> Ptr CWchar -> \
+  IO (Ptr CWchar)
+#bindings_function wcstod , Ptr CWchar -> Ptr (Ptr CWchar) -> \
+  IO CDouble
+#bindings_function wcstof , Ptr CWchar -> Ptr (Ptr CWchar) -> \
+  IO CFloat
+#bindings_function wcstok , Ptr CWchar -> Ptr CWchar -> \
+  Ptr (Ptr CWchar) -> IO (Ptr CWchar)
+#bindings_function wcstold , Ptr CWchar -> Ptr (Ptr CWchar) -> \
+  IO CLDouble
+#bindings_function wcstoll , Ptr CWchar -> Ptr (Ptr CWchar) -> \
+  CInt -> IO CLLong
+#bindings_function wcstol , Ptr CWchar -> Ptr (Ptr CWchar) -> \
+  CInt -> CLong
+#bindings_function wcstoull , Ptr CWchar -> Ptr (Ptr CWchar) -> \
+  CInt -> IO CULLong
+#bindings_function wcstoul , Ptr CWchar -> Ptr (Ptr CWchar) -> \
+  CInt -> IO CULong
+#bindings_function wcsxfrm , Ptr CWchar -> Ptr CWchar -> \
+  CSize -> IO CSize
+#bindings_function wctob , CWint -> IO CInt
+#bindings_function wmemchr , Ptr CWchar -> CWchar -> \
+  CSize -> IO (Ptr CWchar)
+#bindings_function wmemcmp , Ptr CWchar -> Ptr CWchar -> \
+  CSize -> IO CInt
+#bindings_function wmemcpy , Ptr CWchar -> Ptr CWchar -> \
+  CSize -> IO (Ptr CWchar)
+#bindings_function wmemmove , Ptr CWchar -> Ptr CWchar -> \
+  CSize -> IO (Ptr CWchar)
+#bindings_function wmemset , Ptr CWchar -> CWchar -> \
+  CSize -> IO (Ptr CWchar)
+
+#include <wctype.h>
+
+type CWctrans = #bindings_equivalent_integer wctrans_t
+type CWctype = #bindings_equivalent_integer wctype_t
+
+#bindings_function iswalnum , CWint -> IO CInt
+#bindings_function iswalpha , CWint -> IO CInt
+#bindings_function iswblank , CWint -> IO CInt
+#bindings_function iswcntrl , CWint -> IO CInt
+#bindings_function iswctype , CWint -> CWctype -> IO CInt
+#bindings_function iswdigit , CWint -> IO CInt
+#bindings_function iswgraph , CWint -> IO CInt
+#bindings_function iswlower , CWint -> IO CInt
+#bindings_function iswprint , CWint -> IO CInt
+#bindings_function iswpunct , CWint -> IO CInt
+#bindings_function iswspace , CWint -> IO CInt
+#bindings_function iswupper , CWint -> IO CInt
+#bindings_function iswxdigit , CWint -> IO CInt
+#bindings_function towctrans , CWint -> CWctrans -> IO CWint
+#bindings_function towlower , CWint -> IO CWint
+#bindings_function towupper , CWint -> IO CWint
+#bindings_function wctrans , CString -> IO CWctrans
+#bindings_function wctype , CString -> IO CWctype
+
+
diff --git a/src/CConstants.hs b/src/CConstants.hs
deleted file mode 100644
--- a/src/CConstants.hs
+++ /dev/null
@@ -1,7 +0,0 @@
-module CConstants where
-import Foreign
-import Foreign.C
-import CTypes
-
-foreign import ccall _CLOCKS_PER_SEC :: CClock
-
diff --git a/src/CFunctions.hs b/src/CFunctions.hs
deleted file mode 100644
--- a/src/CFunctions.hs
+++ /dev/null
@@ -1,32 +0,0 @@
-module CFunctions where 
-import Foreign
-import Foreign.C
-import CTypes
-
-foreign import ccall clock
-    :: IO CClock
-
-foreign import ccall difftime
-    :: CTime -> CTime -> IO CDouble
-
-foreign import ccall mktime
-    :: Ptr Tm -> IO CTime
-
-foreign import ccall time
-    :: Ptr CTime -> IO CTime
-
-foreign import ccall asctime
-    :: Ptr Tm -> IO CString
-
-foreign import ccall ctime
-    :: Ptr CTime -> IO CString
-
-foreign import ccall gmtime
-    :: Ptr CTime -> IO (Ptr Tm)
-
-foreign import ccall localtime
-    :: Ptr CTime -> IO (Ptr Tm)
-
-foreign import ccall strftime
-    :: CString -> CSize -> CString -> Ptr Tm -> IO CSize
-
diff --git a/src/CTypes.hs b/src/CTypes.hs
deleted file mode 100644
--- a/src/CTypes.hs
+++ /dev/null
@@ -1,75 +0,0 @@
-module CTypes where
-import Foreign
-import Foreign.C
-
--- time.h
-
-data Tm = Tm {
-    tm'sec,
-    tm'min,
-    tm'hour,
-    tm'mday,
-    tm'mon,
-    tm'year,
-    tm'wday,
-    tm'yday,
-    tm'isdst :: CInt
-   }
-
-instance Storable Tm where
-    sizeOf _ = fromIntegral size_of_tm
-    alignment = sizeOf
-    peek p =
-        with 0 $ \p1 -> with 0 $ \p2 -> with 0 $ \p3 ->
-        with 0 $ \p4 -> with 0 $ \p5 -> with 0 $ \p6 ->
-        with 0 $ \p7 -> with 0 $ \p8 -> with 0 $ \p9 ->
-        c2hs_tm p p1 p2 p3 p4 p5 p6 p7 p8 p9 >>
-        peek p1 >>= \v1 -> peek p2 >>= \v2 -> peek p3 >>= \v3 ->
-        peek p4 >>= \v4 -> peek p5 >>= \v5 -> peek p6 >>= \v6 ->
-        peek p7 >>= \v7 -> peek p8 >>= \v8 -> peek p9 >>= \v9 ->
-        return $ Tm v1 v2 v3 v4 v5 v6 v7 v8 v9
-    poke p (Tm v1 v2 v3 v4 v5 v6 v7 v8 v9) =
-        hs2c_tm p v1 v2 v3 v4 v5 v6 v7 v8 v9
-
-foreign import ccall size_of_tm :: CInt
-
-foreign import ccall hs2c_tm
-    :: Ptr Tm -> CInt -> CInt -> CInt -> CInt ->
-       CInt -> CInt -> CInt -> CInt -> CInt -> IO ()
-
-foreign import ccall c2hs_tm
-    :: Ptr Tm -> Ptr CInt -> Ptr CInt -> Ptr CInt -> Ptr CInt ->
-       Ptr CInt -> Ptr CInt -> Ptr CInt -> Ptr CInt ->
-       Ptr CInt -> IO ()
-
--- sys/time.h
-
-data Timeval = Timeval {timeval'tv_sec, timeval'tv_usec :: CLong}
-
-instance Storable Timeval where
-
-    sizeOf _ = fromIntegral size_of_timeval
-
-    alignment = sizeOf
-
-    peek p =
-        with 0 $ \p1 ->
-        with 0 $ \p2 ->
-
-        c2hs_timeval p p1 p2 >>
-
-        peek p1 >>= \v1 ->
-        peek p2 >>= \v2 ->
-
-        return $ Timeval {timeval'tv_sec = v1, timeval'tv_usec = v2}
-
-    poke p v = hs2c_timeval p (timeval'tv_sec v) (timeval'tv_usec v)
-
-foreign import ccall "size_of_timeval" size_of_timeval
-    :: CInt
-
-foreign import ccall "hs2c_timeval" hs2c_timeval
-    :: Ptr Timeval -> CLong -> CLong -> IO ()
-
-foreign import ccall "c2hs_timeval" c2hs_timeval
-    :: Ptr Timeval -> Ptr CLong -> Ptr CLong -> IO ()
diff --git a/src/bindings.macros.h b/src/bindings.macros.h
new file mode 100644
--- /dev/null
+++ b/src/bindings.macros.h
@@ -0,0 +1,168 @@
+#define hsc_bindings_initialize(dummy)\
+    char bindings_buffer[1000]; \
+    char bindings_buffer2[1000];
+
+#define bindings_varid(name) \
+    (strcpy(bindings_buffer+1,name+(strspn(name," "))), \
+     bindings_buffer[0]='_', \
+     islower(bindings_buffer[1])?bindings_buffer+1:bindings_buffer)
+
+#define bindings_conid(name) \
+    (strcpy(bindings_buffer,name+(strspn(name," "))), \
+     bindings_buffer[0] = toupper(bindings_buffer[0]), \
+     bindings_buffer)
+
+#define bindings_integer(name) \
+    (((name)>0) \
+        ? sprintf(bindings_buffer2,"%llu", \
+          (long long unsigned)(name)) \
+        : sprintf(bindings_buffer2,"%lld", \
+          (long long)(name)) \
+    , bindings_buffer2 )
+
+#define hsc_bindings_export_varids(name) \
+    { \
+        char buf[50000]; \
+        char *p = buf; \
+        char *p2 = p; \
+        strcpy(buf,# name); \
+        while (*p) \
+            if (*p == '|') p++; \
+            else \
+            { \
+                p2 = p; \
+                while (*p2 && *p2!='|') p2++; \
+                if (*p2=='|') *(p2++) = '\0'; \
+                printf("%s,",bindings_varid(p)); \
+                p = p2; \
+            } \
+        printf("\n"); \
+    }
+
+#define hsc_bindings_export_conids(name) \
+    { \
+        char buf[50000]; \
+        char *p = buf; \
+        char *p2 = p; \
+        strcpy(buf,# name); \
+        while (*p) \
+            if (*p == '|') p++; \
+            else \
+            { \
+                p2 = p; \
+                while (*p2 && *p2!='|') p2++; \
+                if (*p2=='|') *(p2++) = '\0'; \
+                printf("%s(..),",bindings_conid(p)); \
+                p = p2; \
+            } \
+        printf("\n"); \
+    }
+
+#define hsc_bindings_integer_like(name,type) \
+    printf("%s = %s :: %s\n",bindings_varid(# name), \
+      bindings_integer(name),# type);
+
+#define hsc_bindings_int(name) \
+  printf ("%s = %d :: CInt\n", \
+    bindings_varid(# name),(int)(name));
+
+#define hsc_bindings_char(name) \
+  printf ("%s = %d :: CChar\n", \
+    bindings_varid(# name),(int)(name));
+
+#define hsc_bindings_size(name) \
+  printf ("%s = %zu :: CSize\n", \
+    bindings_varid(# name),(size_t)(name));
+
+#define hsc_bindings_long(name) \
+  printf ("%s = %s :: CLong\n", \
+    bindings_varid(# name),bindings_integer(name));
+
+#define hsc_bindings_ulong(name) \
+  printf ("%s = %s :: CULong\n", \
+    bindings_varid(# name),bindings_integer(name));
+
+#define hsc_bindings_short(name) \
+  printf ("%s = %s :: CShort\n", \
+    bindings_varid(# name),bindings_integer(name));
+
+#define hsc_bindings_ptr(name,htype) \
+  printf ("%s =  wordPtrToPtr (%zu :: WordPtr) :: %s\n", \
+    bindings_varid(# name),(size_t)(name),# htype);
+
+#define hsc_bindings_funptr(name,htype) \
+  printf ("%s = castPtrToFunPtr $ wordPtrToPtr (%zu :: WordPtr) :: %s\n", \
+    bindings_varid(# name),(size_t)(name),# htype);
+
+#define hsc_bindings_num(name) \
+  if ((name)>0) \
+    printf ("%s = %lu :: (Num a) => a\n", \
+      bindings_varid(# name),(long unsigned)(name)); \
+  else \
+    printf ("%s = %ld :: (Num a) => a\n", \
+      bindings_varid(# name),(long)(name));
+
+#define hsc_bindings_frac(name) \
+  printf ("%s = %Le :: (Fractional a) => a\n", \
+    bindings_varid(# name),(long double)(name));
+
+#define hsc_bindings_function(name,type) \
+    printf("foreign import ccall \"%s\" %s :: %s\n", \
+      # name,bindings_varid(# name),# type);
+
+#define hsc_bindings_starttype(name) \
+    { \
+        name *refpointer = 0; \
+        char *type1 = # name; \
+        int nfields = 0; \
+        char *fieldnames[100]; \
+        char *fieldtypes[100]; \
+        size_t fieldoffsets[100]; \
+        size_t typesize = sizeof (name); \
+        int i; \
+        for(i=0;type1[i] && !isspace(type1[i]);i++); \
+        if (isspace(type1[i])) type1 += i+1;
+
+#define hsc_bindings_field(name,type) \
+        fieldnames[nfields] = # name; \
+        fieldtypes[nfields] = # type; \
+        fieldoffsets[nfields] = (size_t) &(refpointer->name); \
+        nfields++;
+
+#define hsc_bindings_stoptype(dummy) \
+        printf("data %s = %s", bindings_conid(type1), \
+          bindings_conid(type1)); \
+        if (nfields>0) printf (" {"); \
+        for(i=0;i<nfields;i++) \
+        { \
+            printf("%s'%s :: %s", bindings_varid(type1), \
+              fieldnames[i], fieldtypes[i]); \
+            if (i+1<nfields) printf(" , "); \
+        } \
+        if (nfields>0) printf ("}"); \
+        printf("\ninstance Storable %s where {sizeOf _ = %zu ; " \
+          "alignment = sizeOf ; peek p = ", bindings_conid(type1), \
+          typesize); \
+        for(i=0;i<nfields;i++) \
+        { \
+            printf("peekByteOff p %zu >>= \\v%d -> ", \
+              fieldoffsets[i],i); \
+        } \
+        printf("return $ %s ",bindings_conid(type1)); \
+        for(i=0;i<nfields;i++) printf("v%d ",i); \
+        printf(" ; poke p (%s ",bindings_conid(type1)); \
+        for(i=0;i<nfields;i++) printf("v%d ",i); \
+        printf(") = "); \
+        for(i=0;i<nfields;i++) printf("pokeByteOff p %zu v%d >> ", \
+          fieldoffsets[i],i); \
+        printf("return () }"); \
+    }
+
+#define hsc_bindings_globalvar(name,type) \
+    printf("foreign import ccall \"&%s\" %s", \
+      # name,bindings_varid(# name)); \
+    printf(" :: GlobalVariable (Ptr (%s))\n",# type);
+
+#define hsc_bindings_equivalent_integer(t) \
+    printf("%s",(t)(-1)<(t)0?"Int":"Word"); \
+    printf("%zu",sizeof(t)*8);
diff --git a/src/cconstants.c b/src/cconstants.c
deleted file mode 100644
--- a/src/cconstants.c
+++ /dev/null
@@ -1,7 +0,0 @@
-#include <time.h>
-
-clock_t _CLOCKS_PER_SEC (void)
-{
-    return CLOCKS_PER_SEC;
-}
-
diff --git a/src/cfunctions.c b/src/cfunctions.c
deleted file mode 100644
--- a/src/cfunctions.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <time.h>
-
diff --git a/src/ctypes.c b/src/ctypes.c
deleted file mode 100644
--- a/src/ctypes.c
+++ /dev/null
@@ -1,57 +0,0 @@
-#include <time.h>
-
-int size_of_tm (void)
-{
-    return sizeof (struct tm);
-}
-
-void hs2c_tm (struct tm *p,
-    int p1, int p2, int p3,
-    int p4, int p5, int p6,
-    int p7, int p8, int p9)
-{
-    p->tm_sec = p1;
-    p->tm_min = p2;
-    p->tm_hour = p3;
-    p->tm_mday = p4;
-    p->tm_mon = p5;
-    p->tm_year = p6;
-    p->tm_wday = p7;
-    p->tm_yday = p8;
-    p->tm_isdst = p9;
-}
-
-void c2hs_tm (struct tm *p,
-    int *p1, int *p2, int *p3,
-    int *p4, int *p5, int *p6,
-    int *p7, int *p8, int *p9)
-{
-    *p1 = p->tm_sec;
-    *p2 = p->tm_min;
-    *p3 = p->tm_hour;
-    *p4 = p->tm_mday;
-    *p5 = p->tm_mon;
-    *p6 = p->tm_year;
-    *p7 = p->tm_wday;
-    *p8 = p->tm_yday;
-    *p9 = p->tm_isdst;
-}
-
-#include <sys/time.h>
-
-int size_of_timeval (void)
-{
-    return sizeof (struct timeval);
-}
-
-void hs2c_timeval (struct timeval *p, long p1, long p2)
-{
-    p->tv_sec = p1;
-    p->tv_usec = p2;
-}
-
-void c2hs_timeval (struct timeval *p, long *p1, long *p2)
-{
-    *p1 = p->tv_sec;
-    *p2 = p->tv_usec;
-}
