GTK2HSC2HS(1)
π GTK2HSC2HS π
okay bestie, sit DOWN, because we're talking about gtk2hsC2hs β the C->Haskell Interface Generator, and this lil manual page lives in section 1 of the manual. she's a whole vibe, she's a modified version of the c2hs(1) command, and she's the helper program you literally cannot build the Gtk2Hs suite of libraries without. no cap. π«Ά
β¨ SYNOPSIS β¨
gtk2hsC2hs [OPTIONS]... [ header-file ] binding-file
πΈ DESCRIPTION πΈ
so this manual page is gonna briefly describe the gtk2hsC2hs command for you. it's giving modified version of c2hs(1), and it's a helper program that is absolutely necessary to build the Gtk2Hs suite of libraries. like, you need her. periodt. π
π OPTIONS π
the programs follow the usual GNU command line syntax, meaning long options start with two dashes (`-`). a summary of options is included below β for a complete description, go read the other documentation, iykyk. π
gtk2hsC2hs accepts the following options:
-h,-?,--helpβ brief help. short king energy, gives you the basics. π-v,--versionβ show version information. she'll tell you who she is. πββοΈ-c CPP,--cpp=CPPβ use executable CPP to invoke the C preprocessor. pick your own preprocessor, main character choice fr fr. β¨-C CPPOPTS,--cppopts=CPPOPTSβ pass CPPOPTS to the C preprocessor. this one is doing the most and we love her for it. π₯-o FILE,--output=FILEβ output result to FILE (and bestie, it should end in.hs). π-t PATH,--output-dir=PATHβ place generated files in PATH. everything goes in her little folder. π-p PLATFORM,--platform=PLATFORMβ platform to use for cross compilation. π-k,--keepβ keep pre-processed C header. she's a hoarder, respectfully. π-l NAME,--lock=NAMEβ wrap each foreign call with the function NAME. π§-d TYPE,--dump=TYPEβ dump internal information (for debugging), where TYPE is one of:traceβ trace compiler phasesgenbindβ trace binding generationctravβ trace C declaration traversalchsβ dump the binding file (adds.dumpto the name)
header-file is the header file belonging to the marshalled library. it must end with suffix .h. π
binding-file is the corresponding Haskell binding file, which must end with suffix .chs. πΈ
PLATFORM β the platform name can be one of: x86_64-linux. i686-linux. m68k-palmos. this allows for cross-compilation, assuming the rest of your toolchain supports that. the default is the current host platform. π
the most useful of these options is probably --cppopts (or -C). if the C header file needs any special options (like -D or -I) to go through the C pre-processor, here is the place to pass them. literally the it-girl of this option list, no notes. π
β EXAMPLES β
when used directly, gtk2hsC2hs is usually called as:
gtk2hsC2hs lib.h Lib.chs
where lib.h is the header file and Lib.chs the Haskell binding module, which define the C- and Haskell-side interface, respectively. if no errors occur, the result is a pure Haskell module Lib.hs, which implements the Haskell API of the library. slay, honestly. π
a more advanced call may look like this:
gtk2hsC2hs --cppopts=-I/some/obscure/dir --cppopts=-DEXTRA lib.h Lib.chs
often, lib.h will not be in the current directory, but in one of the header file directories. apart from the current directory, C->Haskell looks in two places for the header:
- first, in the standard include directory of the used system β this is usually
/usr/includeand/usr/local/include - and second, it will look in every directory that is mentioned in a
-IDIRoption passed to the pre-processor via--cppopts.
π CAVEATS π
if you have more than one option that you want to give to the pre-processor, use multiple --cppopts= flags. do not try to be cute and cram them together, bestie. one flag per option. π
π BUGS π
please report bugs and feature requests in the Gtk2Hs trac:
http://hackage.haskell.org/trac/gtk2hs/
or to the Gtk2Hs mailing list gtk2hs-devel@lists.sourceforge.net. we wanna hear from you, fr fr. π«Ά
π COPYRIGHT π
C->Haskell Compiler, version 0.13.4 (gtk2hs branch) Copyright (c) [1999..2004] Manuel M T Chakravarty <chak@cse.unsw.edu.au>
π· AUTHOR π·
this page was addapted from the c2hs(1) manpage, by Marco TΓΊlio Gontijo e Silva <marcot@debian.org> for the Debian GNU/Linux system (but may be used by others), which was mainly assembled from the original documentation of c2hs.
the c2hs(1) was written by Michael Weber <michael.weber@post.rwth-aachen.de> for the Debian GNU/Linux system (but may be used by others).
and that's the whole page, bestie!! version 0.13.4 (gtk2hs branch), dated November 2004 β a genuine icon, a legend, the moment. go forth and marshal your C into Haskell. mwah. ππβ¨
π¦ where this page comes from
- debian bookworm: gtk2hs-buildtools 0.13.8.3-1+b2 Β· GPL-2.0-only
- debian trixie: gtk2hs-buildtools 0.13.11.0-1+b1 Β· GPL-2.0-only
- ubuntu jammy: gtk2hs-buildtools 0.13.8.0-2 Β· GPL-2.0-only
- ubuntu noble: gtk2hs-buildtools 0.13.10.0-1build1 Β· GPL-2.0-only
- ubuntu questing: gtk2hs-buildtools 0.13.11.0-1build2
- ubuntu resolute: gtk2hs-buildtools 0.13.12.0-1build1 Β· GPL-2.0-only
- ubuntu stonking: gtk2hs-buildtools 0.13.12.0-1build1 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms