Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » allegro compile compile problems for djgpp

Credits go to Matthew Leverton for helping out!
This thread is locked; no one can reply to it. rss feed Print
allegro compile compile problems for djgpp
Alysher
Member #8,406
March 2007
avatar

i hate rehashing problems, but being as i didn't get an answer...

over two weeks ago i had problems compiling allegro for djgpp. it compiled every thing up to the dfile.c and gave me this error:

gcc -DALLEGRO_SRC -DALLEGRO_LIB_BUILD -Wall -Wno-unused -mcpu=i586 -O2 -funroll-loops -ffast-math -fomit-frame-pointer -I. -I./include -o obj/djgpp/alleg/dfile.o -c src/dos/dfile.c
src/dos/dfile.c: In function `al_ffblk_get_size':
src/dos/dfile.c:340: parse error before `struct'
src/dos/dfile.c:342: `ff_data' undeclared (first use in this function)
src/dos/dfile.c:342: (Each undeclared identifier is reported only once
src/dos/dfile.c:342: for each function it appears in.)
src/dos/dfile.c:343: warning: control reaches end of non-void function
make.exe: *** [obj/djgpp/alleg/dfile.o] Error 1

i deleted the allegro directory and unziped it again and ran make with the -k option and found out that every thing else compiles properly except the dfile.c

i attempted to understand what was going on with the file, but the only thing that stood out to me was that the last 5 or 6 lines of code didn't look right:

uint64_t al_ffblk_get_size(struct al_ffblk *info)
{
   ASSERT(info);
   struct FF_DATA *ff_data = (struct FF_DATA *) info->ff_data;

   return ff_data->data.ff_fsize;
}

{accedental prepost--edit}

the more i looked at it the more it seemed to me that the first two lines of code
were backwards. i flip-floped the two lines so that they looked like this:

uint64_t al_ffblk_get_size(struct al_ffblk *info)
{
   struct FF_DATA *ff_data = (struct FF_DATA *) info->ff_data;
   ASSERT(info);

   return ff_data->data.ff_fsize;
}

when i compiled it again it processed correctly. my question is will the new code work the way it is intended to?

EDIT:

ALL LINES OF CODE HAVE BEEN TAKEN FROM LINES 337-343 OF DFILE.C( just to avoid confusion)

I didn't lose my marbles, I never had any to begin with!!!

Matthew Leverton
Supreme Loser
January 1999
avatar

Quote:

when i compiled it again it processed correctly. my question is will the new code work the way it is intended to?

No, it won't. But ASSERT() is just a debug tool, so as long as you aren't throwing NULL pointers around, it will be fine. It really should be:

uint64_t al_ffblk_get_size(struct al_ffblk *info)
{
   struct FF_DATA *ff_data;
   ASSERT(info);
   ff_data = (struct FF_DATA *) info->ff_data;
   return ff_data->data.ff_fsize;
}

Alysher
Member #8,406
March 2007
avatar

so if i replace the code you wrote with what was written then the compile will run properly and the code will work properly. is it possible to update dfile.c in the current stable source so that nobody else has the same problem as i did?

I didn't lose my marbles, I never had any to begin with!!!

Matthew Leverton
Supreme Loser
January 1999
avatar

Yes, it will work as intended. And yes, the source code in SVN has already been updated a while ago. Allegro just doesn't get many releases.

Alysher
Member #8,406
March 2007
avatar

FINALLY!!! thank you for your help and your input.;D;D;D;D

I didn't lose my marbles, I never had any to begin with!!!

Go to: