Messages in this thread | | | Subject | Re: including .c files ? | From | Krzysztof Halasa <> | Date | Fri, 08 Aug 2008 17:46:44 +0200 |
| |
"Chris Friesen" <cfriesen@nortel.com> writes:
>> Doesn't work when you need conditional compilation. > > Sure it does...look at all the kernel Makefiles that compile code > based on whether a config option is set.
Nope, I meant compilation depending on preprocessor variables defined (or not) by the including file. CONFIG_* and things like make variables are completely different things.
Imagine a chip driver (library) doing I/O using either MMIO or inp/outp. The real card driver uses the library and provides necessary glue code. You can either a) make I/O real function calls, call using pointers etc. (slow, should be inline), or b) define the I/O as inline functions or macros and then #include the library. -- Krzysztof Halasa
| |