开发者

Haskell FFI for pdflib

I am trying to wr开发者_如何学运维ite ffi for pdflib library ( pdflib.com ) using c2hs on 64 linux. You can download pdflib from their website for free (fully functional eval.)

I tried to compile and run their hello.c demo program and it works fine.

As far as i understand i need only 2 files to make it work: pdflib.h and libpdf.a

So i put both of them into hello folder, wrote a chs file, it compiles and generates hs file fine. But when i try to compile my Hello.hs program cabal complains

Cabal: Missing dependency on a foreign library: * Missing C library: pdflib

I tried giving it the folder name via --extra-include-dirs and --extra-lib-dirs but it does not help.

How do i compile haskell program with pdflib.h and libpdf.a files ?


Migrated from a comment to an answer:

first: I assume you've got "extra-libraries: pdf" like in your cabal file? You need to make sure the name matches precisely (i.e. is the same as the library file but without the 'lib' prefix). second, i've had mixed results with .a files, probably through my own ignorance, but always had success with .so files. – sclv 19 hours ago


The linker will need to be able to find your .a file. It will look in the usual /usr/lib paths. Can you install pdflib into the regular system locations (e.g. via your package manager)? This will be the easiest path.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜