Unoffical empeg BBS

Quick Links: Empeg FAQ | RioCar.Org | Hijack | BigDisk Builder | jEmplode | emphatic
Repairs: Repairs

Topic Options
#78380 - 07/03/2002 14:19 extern declarations help!
genixia
Carpal Tunnel

Registered: 08/02/2002
Posts: 3411
This is really directed to Mark, although if anyone else can answer, then feel free...

I have added a function to empeg_mixer.c that needs to access a table in hijack.c . The table is of type hijack_db_table_t that is typedef'd in hijack.c

So, I put the following in empeg_mixer.h:

typedef struct hijack_db_table_s {
char *name;
unsigned int dbvalue;
} hijack_db_table_t;

extern const hijack_db_table_t hijack_db_table[25];


but I still get undefined reference errors when linking special.a

By declaring the table as extern in hijack.c as well, everything compiles, links and works, but I get a compiler warning:
hijack.c:411: warning: `hijack_db_table' initialized and declared `extern'

How do I get rid of this warning?
_________________________
Mk2a 60GB Blue. Serial 030102962 sig.mp3: File Format not Valid.

Top
#78381 - 07/03/2002 15:27 Re: extern declarations help! [Re: genixia]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
Move the typedef to hijack.h ("find . -name hijack.h"), declare the table itself in hijack.c with NO extern or static keywords.

Declare it again as "extern" in empeg_mixer.c

Problem solved.

-ml

Top
#78382 - 07/03/2002 15:28 Re: extern declarations help! [Re: mlord]
mlord
carpal tunnel

Registered: 29/08/2000
Posts: 14493
Loc: Canada
And don't neglect to "#include <asm/arch/hijack.h>" in empeg_mixer.c

Top
#78383 - 07/03/2002 17:17 Re: extern declarations help! [Re: mlord]
genixia
Carpal Tunnel

Registered: 08/02/2002
Posts: 3411
Thanks, although I've just seen The Way That I Was Supposed To Do It(tm) - dereference the table in in hijack.c and pass the results as ints in the function call to the function in empeg_mixer.c

This C stuff is fun, but I haven't quite gotten my head around the .h idiosyncracies
_________________________
Mk2a 60GB Blue. Serial 030102962 sig.mp3: File Format not Valid.

Top