dgtlrift/hp2xx

buildsys: many `multiple definition of ...` errors due to hp2xx.h defining vars

Opened this issue · 0 comments

How did this ever compile on modern gcc ?

hp2xx.h defines a few global vars :

unsigned char pattern[8][256][256];
int pat;
int pw[8];
int ph[8];

but that header is included everywhere, so of course the linker goes crazy with multiple definition of 'pw'; fillpoly.o:/../src/hp2xx.h:328: first defined here ....

The fix is pretty simple : move those definitions to hp2xx.c, and change hp2xx.h to

/** some global vars, defined in hp2xx.c */
extern unsigned char pattern[8][256][256];
extern int pat;
extern int pw[8];
extern int ph[8];

I also have a commit fixing this.