www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/29/16:45:19

From: "Raul Carolus" <carolura AT luther DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Passing functions as a parameter in C++
Date: Mon, 29 May 2000 22:33:20 +0200
Organization: T-Online
Lines: 41
Message-ID: <8gukef$c21$18$1@news.t-online.com>
Mime-Version: 1.0
X-Trace: news.t-online.com 959632656 18 12353 320030026865-0001 000529 20:37:36
X-Complaints-To: abuse AT t-online DOT de
X-Sender: 320030026865-0001 AT t-dialin DOT net
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.00.2615.200
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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.  there's 3 because they can be sync'd to
the refreshrate.
Anyway, i want to pass TimerUpdate as one of the functions, so here's how
the function call looks:

MIDASsetTimerCallback(1000, FALSE, &TimerUpdate, NULL, NULL);

But when I try to compile this, it spits back:
"void paramater not ignored as it ought to be".  I've tried a few different
ways of passing it, but nothing works.

Here's the kicker.  I wondered if this would work at all, so i compiled the
example program that used this call.  It compiled and worked fine.  Then I
noticed the example was a .c file.

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?

Thanks in advance for any help.

Raul

--
*********************************************
If it happens, God lets it happen.  If we
say, "I don't understand," God replies
"I don't care."
--Stephen King, "The Green Mile"
*********************************************


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019