public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Error Communicating With Module
@ 2001-02-12 15:21 Ben Rush
  2001-02-12 15:50 ` Brian Gerst
  0 siblings, 1 reply; 3+ messages in thread
From: Ben Rush @ 2001-02-12 15:21 UTC (permalink / raw)
  To: linux-kernel

	Hello, first of all I must tell you that I do not belong to this
mailing list as of yet, so, please respond to me via brush@cse.unl.edu.
Thank you very much in advance!

	My problem is as follows: 

	I have added a variable named bens_variable to ksyms.c as follows: 

	extern int bens_variable=10; 

	I have then exported the variable in ksyms.c as follows: 

	EXPORT_SYMBOL(bens_variable); 

	I then recompiled the kernel as bzImage and everything went
perfectly fine. I then wrote a module for that particular kernel which
is simple and looks as follows: 

	#define MODULE
	#define __KERNEL__
	#include <linux/module.h>

	int init_module(void){
		printk(bens_variable); 
		return 0; 
	}
	
	void cleanup_module(void){
		printk("<1>Module Unloaded\n"); 
	}

	But, of course, whenever I try and compile the module to load it
using gcc it tells me that bens_variable is undefined - which makes sense,
however I don't see how I can compile this without typing in 

	extern int bens_variable; 

	again. How do I get my module to compile and print out the value
of bens_variable as defined within ksyms.c? 

	Again, please respond to me via brush@cse.unl.edu. Thanks again in
advance!!!

	~Ben
	brush@cse.unl.edu

	******************************************************
		    Benjamin Rush (brush@cse.unl.edu)
			http://cse.unl.edu/~brush/
		  Undergradute Computer Scientist @ UNL
	*******************************************************


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://vger.kernel.org/lkml/

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

* Re: Error Communicating With Module
  2001-02-12 15:21 Error Communicating With Module Ben Rush
@ 2001-02-12 15:50 ` Brian Gerst
  2001-02-12 16:22   ` Richard B. Johnson
  0 siblings, 1 reply; 3+ messages in thread
From: Brian Gerst @ 2001-02-12 15:50 UTC (permalink / raw)
  To: Ben Rush; +Cc: linux-kernel

Ben Rush wrote:
> 
>         Hello, first of all I must tell you that I do not belong to this
> mailing list as of yet, so, please respond to me via brush@cse.unl.edu.
> Thank you very much in advance!
> 
>         My problem is as follows:
> 
>         I have added a variable named bens_variable to ksyms.c as follows:
> 
>         extern int bens_variable=10;
> 
>         I have then exported the variable in ksyms.c as follows:
> 
>         EXPORT_SYMBOL(bens_variable);
> 
>         I then recompiled the kernel as bzImage and everything went
> perfectly fine. I then wrote a module for that particular kernel which
> is simple and looks as follows:
> 
>         #define MODULE
>         #define __KERNEL__
>         #include <linux/module.h>
> 
>         int init_module(void){
>                 printk(bens_variable);
>                 return 0;
>         }
> 
>         void cleanup_module(void){
>                 printk("<1>Module Unloaded\n");
>         }
> 
>         But, of course, whenever I try and compile the module to load it
> using gcc it tells me that bens_variable is undefined - which makes sense,
> however I don't see how I can compile this without typing in
> 
>         extern int bens_variable;
> 
>         again. How do I get my module to compile and print out the value
> of bens_variable as defined within ksyms.c?

Turn module versioning off.

--

				Brian Gerst
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://vger.kernel.org/lkml/

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

* Re: Error Communicating With Module
  2001-02-12 15:50 ` Brian Gerst
@ 2001-02-12 16:22   ` Richard B. Johnson
  0 siblings, 0 replies; 3+ messages in thread
From: Richard B. Johnson @ 2001-02-12 16:22 UTC (permalink / raw)
  To: Brian Gerst; +Cc: Ben Rush, linux-kernel

On Mon, 12 Feb 2001, Brian Gerst wrote:

> Ben Rush wrote:
> > 
> >         Hello, first of all I must tell you that I do not belong to this
> > mailing list as of yet, so, please respond to me via brush@cse.unl.edu.
> > Thank you very much in advance!
> > 
> >         My problem is as follows:
> >         I have added a variable named bens_variable to ksyms.c as follows:
> >         extern int bens_variable=10;
            ^^^^^^

Yes. But where is this allocated?? This statement says that it's
someplace else.

Remove "extern".

[SNIPPED]
> > 
> >         #define MODULE
> >         #define __KERNEL__
> >         #include <linux/module.h>
> >

	... add:

	    extern int bens_variable;
 
> >         int init_module(void){
> >                 printk(bens_variable);
> >                 return 0;
> >         }
> > 
> >         void cleanup_module(void){
> >                 printk("<1>Module Unloaded\n");
> >         }
> > 

Cheers,
Dick Johnson

Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).

"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://vger.kernel.org/lkml/

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

end of thread, other threads:[~2001-02-12 16:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-02-12 15:21 Error Communicating With Module Ben Rush
2001-02-12 15:50 ` Brian Gerst
2001-02-12 16:22   ` Richard B. Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox