Question about structure declaration

This is a discussion on Question about structure declaration within the C Programming forums, part of the General Programming Boards category; Hi. I was browsing through the apache source code and I found the following in the mod_so.c file: Code: module ...

  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    66

    Question about structure declaration

    Hi.

    I was browsing through the apache source code and I found the following in the mod_so.c file:

    Code:
    module AP_MODULE_DECLARE_DATA so_module = {
       STANDARD20_MODULE_STUFF,
       NULL,                 /* create per-dir config */
       NULL,                 /* merge per-dir config */
       so_sconf_create,      /* server config */
       NULL,                 /* merge server config */
       so_cmds,              /* command apr_table_t */
       register_hooks        /* register hooks */
    };
    I guess the AP_MODULE_DECLARE_DATA is a structure, but can somebody explain to me, what the "module" can be?

    As I know if I declare a structure like this:

    Code:
    typedef struct
    {
    int variable;
    } my_struct_t;
    than I will be able to use this structure like this:

    Code:
    my_struct_t obj = {
    10;
    };
    Just to be clear, I'm not interested in what this structure is actually doing in apache, it is just an example to my question.

    Can be the "module" keyword only just an alias for struct, so it would be something like this?

    struct AP_MODULE_DECLARE_DATA so_module;

    Thank you.

  2. #2
    Registered User
    Join Date
    Sep 2008
    Posts
    200
    It could well be an alias for struct, perhaps with an additional compiler directive to put it in a certain section or whatever. It'll probably be defined as a macro in some header file - I'd suggest grepping through the source for lines that contain both 'module' and 'define'.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Structure declaration
    By rk211083 in forum C Programming
    Replies: 18
    Last Post: 06-23-2010, 03:52 AM
  2. int s: 3 ; declaration in structure is possible
    By nkrao123@gmail. in forum C Programming
    Replies: 3
    Last Post: 12-17-2009, 06:17 AM
  3. Can you use a structure in the declaration of itself?
    By ititrx in forum C++ Programming
    Replies: 23
    Last Post: 11-07-2006, 03:40 PM
  4. external structure declaration
    By aze in forum C Programming
    Replies: 5
    Last Post: 04-16-2004, 05:27 PM
  5. structure declaration
    By Roaring_Tiger in forum C Programming
    Replies: 1
    Last Post: 03-26-2003, 11:22 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21