All of lore.kernel.org
 help / color / mirror / Atom feed
* Problem in EXPORT_SYMBOL.. Please Help!
@ 2002-12-24 16:20 Dhirendra Pal Singh
  2002-12-25 15:33 ` Sam Ravnborg
  0 siblings, 1 reply; 2+ messages in thread
From: Dhirendra Pal Singh @ 2002-12-24 16:20 UTC (permalink / raw)
  To: linux-kernel

Hi All
I am trying to resolve the problem of EXPORT_SYMBOL. I have raised this 
question on newbies kernel list but no one replied. Hence I am posting 
it here.
I am using kernel 2.4.18-14. Below is the listing of a simple test code.

**************************************
/*main.c*/

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

#if CONFIG_MODVERSION == 1
#define MODERVSION
#include <linux/modversions.h>
#endif

int print_func()
{
	printk("Entry point.\n");
	return 0;
}

EXPORT_SYMBOL(print_func);

int init_module()
{
	print_func();
	return 0;
}

void cleanup()
{
	printk("End of story.\n");
}

********************************************

********************************************
/*Makefile*/

export-objs	:= main.o
CC=gcc
MAKE = make
KERNELDIR = /usr/src/linux-2.4.18-14
MODCFLAGS := --save-temps -Wall -D__KERNEL__ -DMODULE -DLINUX -DMODVERSIONS

main.o:		main.c 
		$(CC) $(MODCFLAGS) -I$(KERNELDIR)/include -c main.c

clean:
	rm -fr *.o *.i *.s

***********************************************

And on compiling the error is as follows...

gcc --save-temps -Wall -D__KERNEL__ -DMODULE -DLINUX -DMODVERSIONS -I/usr/src/linux-2.4.18-14/include -c main.c
main.c:15: parse error before "this_object_must_be_defined_as_export_objs_in_the_Makefile"
main.c:15: warning: type defaults to `int' in declaration of `this_object_must_be_defined_as_export_objs_in_the_Makefile'
main.c:15: warning: data definition has no type or storage class

The error says export_ojbs must be defined. As you can see I have already defined them in the Makefile. 

Pleaes help. I am kind of stucked in my project.

Thanks in advance..
Dp

make: *** [main.o] Error 1





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Problem in EXPORT_SYMBOL.. Please Help!
  2002-12-24 16:20 Problem in EXPORT_SYMBOL.. Please Help! Dhirendra Pal Singh
@ 2002-12-25 15:33 ` Sam Ravnborg
  0 siblings, 0 replies; 2+ messages in thread
From: Sam Ravnborg @ 2002-12-25 15:33 UTC (permalink / raw)
  To: Dhirendra Pal Singh; +Cc: linux-kernel

On Tue, Dec 24, 2002 at 08:20:41AM -0800, Dhirendra Pal Singh wrote:
> Hi All
[Problem with exported symbol]

Kai G. posted this receipt the other day:
------------
Well, you can do

cd my_module
echo "obj-m := my_module.o" > Makefile
vi my_module.c
make -C <path/to/kernel/src> SUBDIRS=$PWD modules

That's not too bad (and basically works for 2.4 as well)
------------

That should catch any compiletime problems. Just stick in:
echo "export-objs := my_module.o" >> Makefile
To mark it a module with exported symbols.

And for 2.4 you need to include Rules.make:
echo "include path/to/Rules.make"

HTH,
	Sam

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-12-25 15:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-24 16:20 Problem in EXPORT_SYMBOL.. Please Help! Dhirendra Pal Singh
2002-12-25 15:33 ` Sam Ravnborg

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.