Writing Libraries for General Use

23 Dec 2009

I've noticed the 'mbed' library (thats added to all projects in the compiler) can be expanded to give an overview of the API for the included header files.

I'm not planning on making a library in the immediate future, but I'm wondering if there is some special way of preparing a library I might produce so that the mbed compiler will know how to display a breakdown of its use in a similar fashion. Something along the lines of ruby's rdoc would be very handy (is there an equivalent in C?).

I found it a little frustrating having to flick around the place looking for the documentation to the HTTPClient library and sort of expected the documentation to be available when I expanded the cog-icon - the library version information is useful, but I think it could be relegated to the right-click menu or similar?

Finally, if I were to write a library (hosted on github, lets say) is there a structure I should conform to so that the mbed compiler would be able to immediately pick up where the pre-compiled and source files are? It'd be nice to have one 'magic' URL that I could give to prospective users of the library and say "plug this into the compiler, and it'll all just work".

I know this might seem a little basic and picky, but I've been totally absorbed by how easy it's been to get my mbed to just do what I want it to do - for me it's been half because of the excellent work the team has put into the compiler, the cookbook and handbook and half because of the readiness of you guys here in the forum who are prepared to answer the innane questions of a beginner!

Happy holidays all!

24 Dec 2009
JP Hastings-Spital wrote:
I'm wondering if there is some special way of preparing a library I might produce so that the mbed compiler will know how to display a breakdown of its use in a similar fashion. Something along the lines of ruby's rdoc would be very handy (is there an equivalent in C?).

The auto-doc generator we've been using for the mbed libraries is NaturalDocs but as you suggest, we want to make the functionality available for any libraries anyone writes. Whilst NaturalDocs is by far my favourite, I think we're likely to move over to the Javadoc style documentation syntax using Doxygen; whilst not as pretty syntax IMO, it is more standard and I think that wins. Interested in any comments on experience with Javadoc, Doxygen, others or opinions in this area.

To write a library and post it on github, I'd suggest do what feels natural then we can compare notes. The mbed compiler will be getting incremental builds so pre-compiled won't be such of an issue, but the "plug this in to the compiler" is a great target and I hope we can end up there. We'll do some prototypes early next year, so if you have a go at presenting a library in a way that feels natural to you, we can then see if we can plumb it all together.

Simon