public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Why cmd_tbl_t is referenced as extern in defining __u_boot_cmd_start?
@ 2010-11-02 15:56 legendbb
  2010-11-09 14:20 ` Mike Frysinger
  0 siblings, 1 reply; 2+ messages in thread
From: legendbb @ 2010-11-02 15:56 UTC (permalink / raw)
  To: u-boot


line 64 and 65 in include/command.h

extern cmd_tbl_t  __u_boot_cmd_start;
extern cmd_tbl_t  __u_boot_cmd_end;

definition of cmd_tbl_t is just one line above these. Why "extern" is used?

Thanks,

struct cmd_tbl_s {
	char		*name;		/* Command Name			*/
	int		maxargs;	/* maximum number of arguments	*/
	int		repeatable;	/* autorepeat allowed?		*/
					/* Implementation function	*/
	int		(*cmd)(struct cmd_tbl_s *, int, int, char *[]);
	char		*usage;		/* Usage message	(short)	*/
#ifdef	CONFIG_SYS_LONGHELP
	char		*help;		/* Help  message	(long)	*/
#endif
#ifdef CONFIG_AUTO_COMPLETE
	/* do auto completion on the arguments */
	int		(*complete)(int argc, char *argv[], char last_char, int maxv, char
*cmdv[]);
#endif
};

typedef struct cmd_tbl_s	cmd_tbl_t;

extern cmd_tbl_t  __u_boot_cmd_start;
extern cmd_tbl_t  __u_boot_cmd_end;
-- 
View this message in context: http://old.nabble.com/Why-cmd_tbl_t-is-referenced-as-extern-in-defining-__u_boot_cmd_start--tp30115036p30115036.html
Sent from the Uboot - Users mailing list archive at Nabble.com.

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

* [U-Boot] Why cmd_tbl_t is referenced as extern in defining __u_boot_cmd_start?
  2010-11-02 15:56 [U-Boot] Why cmd_tbl_t is referenced as extern in defining __u_boot_cmd_start? legendbb
@ 2010-11-09 14:20 ` Mike Frysinger
  0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2010-11-09 14:20 UTC (permalink / raw)
  To: u-boot

On Tuesday, November 02, 2010 11:56:31 legendbb wrote:
> line 64 and 65 in include/command.h
> 
> extern cmd_tbl_t  __u_boot_cmd_start;
> extern cmd_tbl_t  __u_boot_cmd_end;
> 
> definition of cmd_tbl_t is just one line above these. Why "extern" is used?

basic C question ?  if you dont have the extern, you'd be declaring storage 
for two variables instead of references to the symbols elsewhere.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20101109/31e53fee/attachment.pgp 

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

end of thread, other threads:[~2010-11-09 14:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-02 15:56 [U-Boot] Why cmd_tbl_t is referenced as extern in defining __u_boot_cmd_start? legendbb
2010-11-09 14:20 ` Mike Frysinger

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