From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4936 invoked by alias); 12 Apr 2002 12:49:13 -0000 Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org Received: (qmail 4904 invoked from network); 12 Apr 2002 12:49:09 -0000 Received: from unknown (HELO finch-post-12.mail.demon.net) (194.217.242.41) by sources.redhat.com with SMTP; 12 Apr 2002 12:49:09 -0000 Received: from mailgate.softwire.co.uk ([62.49.203.138] helo=polarbear) by finch-post-12.mail.demon.net with esmtp (Exim 3.35 #1) id 16w0UC-0001pM-0C; Fri, 12 Apr 2002 12:49:04 +0000 From: "Rupert Wood" To: "'Glover George'" Cc: Subject: RE: Pointer to a function forbid!! Date: Fri, 12 Apr 2002 05:56:00 -0000 Message-ID: <616BE6A276E3714788D2AC35C40CD18D12004E@whale.softwire.co.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal In-reply-to: <616BE6A276E3714788D2AC35C40CD18D5B1F89@whale.softwire.co.uk> X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Importance: Normal X-SW-Source: 2002-04/txt/msg00126.txt.bz2 Glover George wrote: > Here's where I'm passing the address of > gate.DeviceCallbakEventHandler() to a function (which is part of the > Intel UPnP SDK, I'll put it's declaration below). : > I know there can be pointers to functions, but I'm not understanding > why it won't work here. Because it's a non-static class member function. Non-static member functions expect to be passed (behind the scenes) the address of the object that they were invoked on. They need this to use as the value of their 'this' pointer. The language doesn't support 'binding' a function pointer and an object pointer together to use as a pointer to that operation on that object. If the function must be a member of Gate, and Gate has scope in main() then you could give the Gate global scope and create a trivial wrapper function also at global scope: int GateDeviceCallbackEventHandler(args) { return gate.DeviceCallbackEventHandler(args); } I don't really like the idea of that from a 'cleanliness' viewpoint, but if it must refer to a specific instance of a gate object then that's probably the best way. Rup.