Re: how to export functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2007/7/12, hari krishna angadi <reachtohari@xxxxxxxxx>:
hi,
 i am getting -1 Unknown symbol in module when i try to insert the module
2.ko
/* 1.c  */
#include <linux/kernel.h>
   #include <linux/init.h>
   #include <linux/module.h>
 int example()
{
        printk("<1> i am in function");
        return 0;
}
  MODULE_LICENSE("Dual BSD/GPL");

  static int hello_init(void)
  {
          printk(KERN_ALERT "Hello, world\n");
          return 0;
  }

  static void hello_exit(void)
  {
          printk(KERN_ALERT "Goodbye, cruel world\n");
  }

  module_init(hello_init);
  module_exit(hello_exit);

/ * 2.c */
#include <linux/kernel.h>
   #include <linux/init.h>
   #include <linux/module.h>

  MODULE_LICENSE("Dual BSD/GPL");
extern  int example();
  static int world_init(void)
  {     example();
          printk(KERN_ALERT "Hello, world\n");
          return 0;
  }

  static void world_exit(void)
  {
          printk(KERN_ALERT "Goodbye, cruel world\n");
  }

  module_init(world_init);
  module_exit(world_exit);


i tried to insert 1.ko it inserted inot kernel
when tried to insert  2.ko
i get  (-1 Unknown symbol in module)
    i got some idea i.e  to export the function example how to do?

EXPORT_SYMBOL(example); in 1.c

--
noone is alone.

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux