[jhc] dynamic library support?

John Meacham john at repetae.net
Thu Aug 6 23:18:16 EDT 2009


On Fri, Aug 07, 2009 at 12:32:22PM +1000, Mark Wotton wrote:
> Colour me shocked, if I just comment out the main function, the exported 
> functions work fine.

Cool! I was hoping it would  be that easy but wasn't quite sure as I
have never tested it.

I guess the only thing to get jhc to officially support creating C
librares would be to add an option that will omit main and call gcc with
slightly different options to compile a library. If we want to get fancy
we could have it spit out an appropriate .h file as well :)

I would happily help if someone wanted to work on this. It fits right in
with jhc's strengths.

> Thanks, this is really helpful. I'd like to see if other packages work  
> as well - how do you enable extra libraries like containers?

you use the '-p' option like '-pcontainers'. The p stands for 'package'.
I sometimes call libraries packages and vice versa. I had some reasoning
for this back in the day, but it may no longer be relevant, what do
people think I should do to clean up the terminology?

Note that I am completely overhauling the ho file format and library
support to make jhc signifigantly faster at loading them and more memory
efficient. Among other things, the type checking information can be
loaded independently so jhc can go through and typecheck your entire
project in seconds before it starts trying to compile anything, this
should greatly help the user experince when in a 'compile-test' loop. As
an indicator of speed, jhc will typecheck _all_ of base from scratch in
less than a minute. So no need to baby sit your large compiles. if it
gets past the first minute, you can go on your coffee break and know it
won't run into a type error half way through.

As a side effect, libraries are currently broken in the darcs repository
version of jhc, but I am working on that as well as a 'jhc-pkg' tool to
help maintain them. 

        John 



-- 
John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/


More information about the jhc mailing list