oh no
i think the prefab djgpp+allegro dos cross compiler i have doesn't recognize 0b binary constants
oh noooooo
oh no
i think the prefab djgpp+allegro dos cross compiler i have doesn't recognize 0b binary constants
oh noooooo
after several hours of messing around i have djgpp with a modern version of gcc and allegro 4.2.2 on windows (with soundblaster fix) as well as a test program in dos working!
instructions will be in my next post(s)
i got djgpp binaries from https://github.com/andrewwutw/build-djgpp
and allegro 4 source from https://github.com/msikma/allegro-4.2.2-xc
then i edited xmake.sh to point at djgpp and ran ./xmake.sh lib
but it turns out i needed dependencies anyway so i used this from build-djgpp's readme:
sudo apt-get update
sudo apt-get install bison flex curl gcc g++ make texinfo zlib1g-dev g++ unzip
and then it worked, leaving liballeg.a in lib/djgpp
i then copied liballeg.a and the include folder from allegro to my windows box where i put liballeg.a in \lib\ and the includes in \include\ folders inside the djgpp folder that i got from the DJGPP for MinGW standalone binaries
i then took this allegro test from here https://github.com/msikma/allegro-dos-example/blob/master/src/main.c
and used i586-pc-msdosdjgpp-gcc to compile it. made a batch file for it which you can find below
ok so when i tried to include <allegro.h> from multiple compilation units i got a whole bunch of duplicate definitions error. turns out it's allegro's special inline functions
i found this https://stackoverflow.com/questions/12747198/compiling-error-when-std-gnu99-and-inline-function-is-used which says you can use -fgnu89-inline to fix it
but i didn't wanna do that because it's not 1989 anymore
so i looked and found they use an `AL_INLINE` function-like macro
so i defined this before including allegro.h:
#define AL_INLINE(ret, func, args, ...) static inline __attribute__((always_inline)) ret func args __VA_ARGS__
you can get rid of the __attribute__((always_inline)) i guess if you want