Mail Archives: djgpp/2000/05/30/07:00:47
Raul Carolus <carolura AT luther DOT edu> wrote:
> Ok, i'm about to blow my computer up over this problem.
> I have a nice little function:
> void TimerUpdate() { GlobalTime++; }
> all set up to hook to a timer. I'm using Allegro and the MIDAS sound
> library in my
> project. Since Midas doesn't like to work with Allegro's timer functions,
> i'm using one of midas's:
> MIDASsetTimerCallback(int, bool, void*, void*, void*);
> The three void*'s are functions.
Thats extremely bad programming style on the side of MIDAS. Even in C,
you are not allowed to call a function through a pointer that has been
casted to 'void *', before it's used. You invoke undefined behaviour
that way. C++, because of its polymorphism support and its
consequences, is even stricter than C, here.
> So, my problem is, I really would like to use this, but it seems to not like
> C++ very much. Can someone aid me in resolving my problem?
Have you checked whether the MIDAS prototype for
MIDASSetTimerCallback() is contained in an 'extern "C" { }' block? If
it isn't, you should add one.
--
Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
Even if all the snow were burnt, ashes would remain.
- Raw text -