Menu

#28 Can't include xalleg.h in C++ programs

closed
nobody
Linux (33)
5
2012-10-09
2001-07-18
Anonymous
No

I tried to include xalleg.h in my C++ program and it even didn't compile. I also tried to include it in
C program and it works fine. With some workarounds C++ program also compiled fine. Here are 2
bugs that I found.

Bug # 1: allegro/aintlnx.h line 73
private is a C++ keyword, the structure field must be renamed to some other name.

Bug # 2: xalleg.h lines 142-147
These variables must be declared with AL_FUNCPTR. With AL_METHOD they are declared as global
variables, and in C++ linker will link to these variables that will have a NULL pointer values that
causes a crash at startup and not to the variables in library where they have initialized to the
default values. Even more - if I will include xalleg.h in multiple C++ files, my program will not link at
all. In C linker links to the declarations with initializations and redeclared global variables without
initialization will be treated as prototypes.

Discussion


Log in to post a comment.