The HyperNews Linux KHG Discussion Pages

## My module won't compile! What is wrong?

  Forum: Device Drivers
  Keywords: module write compile help
  Date: Tue, 14 Apr 1998 11:48:38 GMT
  From: Johan <d3sunden@dtek.chalmers.se>

    When i compile i get this:
    %> gcc -DMODVERSIONS -DMODULE -D__KERNEL__ -DEXPORT_SYMTAB    -Wall -Wstrict-prototypes -O6 -c MyModule.c
    MyModule1.c:41: macro `_basic_version' used with just one arg

    line 41 is X(decide), in my symbol_table.
    If I use a symbol that exists (like netif_rx) instead of decide, then I get it to compile but that is not what I want.
    I run v. 2.0.33 on a i386

    I will be grateful for any clues.
    ---------------module code------------------------
    /* #define __KERNEL__ */
    /* #define MODULE */

    #include <asm/segment.h>
    #include<linux/skbuff.h>
    #include<linux/if_ether.h>
    #include<linux/in.h>
    #include <linux/ip.h>
    #include <linux/icmp.h>

    #include <linux/config.h>
    #ifdef MODULE
    #ifdef MODVERSIONS
    #include <linux/modversions.h>
    #endif
    #include <linux/module.h>
    #include <linux/version.h>
    #else
    #define MOD_INC_USE_COUNT
    #define MOD_DEC_USE_COUNT
    #endif

    extern int printk(const char* fmt, ...);

    int decide(struct sk_buff *skb) {
      struct iphdr    *iph = (struct iphdr *)skb->data;
      if((ntohs(skb->mac.ethernet->h_proto) == ETH_P_IP)
         && (iph->protocol == IPPROTO_ICMP)) {
        printk("Filtering!\n");
        return 1;
      }
      return 0;
    }

    int init_module(void) {

      static struct symbol_table decide_syms = {
      #include <linux/symtab_begin.h>
        X(decide),                /*<<<<<This is the evil line */
      #include <linux/symtab_end.h>
      };

      register_symtab(&decide_syms);
      printk("My module is in!\n");
      return 0;
    }

    void cleanup_module(void) {
      printk("My module is out!\n");
     return;
    }

Messages