#include order in modules

#include order in modules

Post by Matt » Mon, 12 Mar 2001 07:57:24



Can anyone give me a rough order of the #includes that I should have at
the top of my kernel driver. I've looked at some of the drivers in the
kernel source and they all differ :)

I've got:

#include <linux/config.h>
#include <linux/version.h>

#ifdef MODVERSIONS
#include <linux/modversions.h>
#endif

#ifdef MODULE
#include <linux/module.h>
#endif

#include <linux/kernel.h>
...

Anything wrong with that?

Cheers

Matt

 
 
 

1. Does order of include files matter???

I wrote a very simple program to access the echo service of a remote
server. In my program, I noticed that when I included my files in this
order:

# include <sys/socket.h>
# include <sys/types.h>

I got some compile errors: (specifically: 'parse error before u_short' in
the file socket.h. The location refered to was in the struct sockaddr
definition)
Strangely, when I reversed the order of the files (put types.h before
socket.h), my program compiled and ran successfully.

Aren't include files supposed to be independant of each other (or
if not, include the necessary files they depend on)?

2. How to cut one line instead of colume

3. Fix order of #includes in init/version.c

4. Transfer all account to other Linux box

5. SSI includes including relative includes?

6. Question about compiler behavior

7. include order for i2c-amd8111

8. Any automounter facility available for FreeBSD except 'amd'?

9. 2/2 Initialization Ordering For Built-in Modules

10. 1/2 Initialization Ordering For Built-in Modules

11. modules order in apache..

12. Apache 2, SSI inconsistency maybe from module order

13. Apache, PHP & module order