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 phases
    • genbind β€” trace binding generation
    • ctrav β€” trace C declaration traversal
    • chs β€” dump the binding file (adds .dump to 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:

  1. first, in the standard include directory of the used system β€” this is usually /usr/include and /usr/local/include
  2. and second, it will look in every directory that is mentioned in a -IDIR option 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. 🫢


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. πŸ’‹πŸ’–βœ¨