From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12688 invoked by alias); 8 Apr 2002 04:16:41 -0000 Mailing-List: contact pthreads-win32-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sources.redhat.com Received: (qmail 12510 invoked from network); 8 Apr 2002 04:16:36 -0000 Received: from unknown (HELO outhub2.tibco.com) (63.100.100.156) by sources.redhat.com with SMTP; 8 Apr 2002 04:16:36 -0000 Received: by outhub2.tibco.com; id VAA27348; Sun, 7 Apr 2002 21:16:35 -0700 (PDT) Received: from osprey.tibco.com(160.101.240.44) by outhub2.tibco.com via smap (V4.1) id xma027337; Sun, 7 Apr 02 21:16:04 -0700 Received: from mail1.tibco.com (nsmail2.tibco.com [10.106.128.42]) by osprey.tibco.com (8.9.3/8.9.3) with ESMTP id VAA03279 for ; Sun, 7 Apr 2002 21:15:11 -0700 (PDT) Received: from yliudt ([10.105.131.21]) by mail1.tibco.com (Netscape Messaging Server 4.15) with SMTP id GU8EIR00.CTP; Sun, 7 Apr 2002 21:16:03 -0700 Message-ID: <001201c1deb4$113ec350$1583690a@tibco.com> From: "Ye Liu" To: , References: Subject: Re: pthread_create(&ID, NULL, ***AC++MemberFunction***, NULL); Date: Sun, 07 Apr 2002 21:16:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 X-SW-Source: 2002/txt/msg00050.txt.bz2 why the routine of pthread_create should be a static function: in compilation time, the compiler need an address of the routine, non static function has no address in the compilation time. i.e., address of automatic class member function is resolved in run time. --ye ----- Original Message ----- From: "Tim Hutt" To: Sent: Sunday, April 07, 2002 7:07 AM Subject: Re: pthread_create(&ID, NULL, ***AC++MemberFunction***, NULL); > 07/04/02 14:38:30, "XDLai" wrote: > > >The C++ member function must be a static function. > > But now I cant call non-static member function of the same class from the thread function: > > c:\t\cpp\killbot\bot.cpp(124) : error C2352: 'CBot::Connect' : illegal call of non-static member function > c:\t\cpp\killbot\bot.h(32) : see declaration of 'Connect' > > I managed to get it to work another way by having it as a global friend function of the class, and passing a pointer to the class as the paramater: > > CBot class > { > > friend void* Main(void* pData); > > > bool OtherMemberFunction(); > } > > void* Main(void* pData) > { > CBot* pBot = (CBot*)pData; > > pBot->OtherMemberFunction(); > } > > > > Suggest any better way? >