![]() We've added our own makeLib build script to the preBuild (while preserving the old simpleUserHooks version), and use a Cabal utility function rawSystemExit to do most of the lifting for us. RawSystemExit (fromFlag $ buildVerbosity flags) "env" GENERATED by C->Haskell Compiler, version 0.16.2 Crystal Seed, (Haskell) The code you see will look something like this: ![]() In general, the hs file will be located in the dist/build directory, as this build message (generated by GHC, not c2hs) shows: You should not be afraid of looking at the preprocessor output in many cases, it will be far more elucidating when you're trying to fix a type error. Once a chs file has been preprocessed, Cabal will not look at it any more. (There is some Cabal hook code for adding c2hs preprocessor support, but it is completely unnecessary.) You should be able to compile an empty Haskell module that has chs as its file extension now. However, since this operation might fail if the user hasn't installed c2hs, you should add the following line to your Cabal file: Trick question Cabal will automatically detect files with the extension chs and run c2hs with appropriate flags on them. ![]() I'll talk about how to setup a Cabal file for linking in C files, which is applicable to any sort of FFI writing (as it turns out, enabling c2hs is the trivial bit).Įnabling c2hs. ![]() Fortunately, with cabal init, this is easier than ever. You should know how to write, configure and build a vanilla Cabal file for pure Haskell. Today, we discuss getting the damn thing to compile in the first place. This part two of a six part introduction to c2hs. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |