A Note on My BoostC Projects and Libraries

From OpenCircuits
Jump to navigation Jump to search

Draft, not ready for reading


I am fairly new to C and not an expert in the structure of larger projects. The following applies to my projects using what I have been calling Libraries. Now most libaries in C are distributed as object files and then linked into their projects. I am not quie sure how to best do this and in any case I want to distribute the source code. Finally I want to be able to use conditional compilation and do not know how to achieve the same effects without compiling everyting at once. So to use on of the libaries you need to make a copy of it and its .h file and add it to the other files for the project. Additionally there is some content that needs to be included in all files. For that purpose I have a file called Project.h it is included in all the files of the project.

Libraries are typically distrubuted in 2 .c files. One contains the source code of the libary the other is a sample/test/demo program that uses the libary. Of course there is also a set of .h files including Project.h

Normally each library has a demo application consisting of a .c and .h file that shows how to use the library.

Some of my older projects have a structure that is simpler.

Projects of mine on this Wiki:

Other Files[edit]

All these files contain internal documentation, for more information read it.

  • Project.h

Including Project.h in your files should not cause any problems or increase code size unless we have some name collisions, take a look for a quick check. It contains #define for the clock speed, crystal, baud rate....

  • Fuse.h

This should be included once in the main c program ( after Project.h ) to set the processor fuses. It interacts with the target processor and the settings in Project.h

BoostC Libraries[edit]

I believe that BoostC libraries deal with conditional compilation by having real code to be compiled in the .h header files. Code that does not need conditional compilation is precompiled in the library ( non-source ) files.

More Reading[edit]