From: Tim Hutt <tim.hutt@btinternet.com>
To: pthreads-win32@sources.redhat.com
Subject: Re: pthread_create(&ID, NULL, ***AC++MemberFunction***, NULL);
Date: Sun, 07 Apr 2002 07:07:00 -0000 [thread overview]
Message-ID: <E16uDKI-0004a2-00@tungsten.btinternet.com> (raw)
07/04/02 14:38:30, "XDLai" <xdlai@wmlab.csie.ncu.edu.tw> 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?
next reply other threads:[~2002-04-07 14:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-04-07 7:07 Tim Hutt [this message]
2002-04-07 21:16 ` Ye Liu
-- strict thread matches above, loose matches on Subject: below --
2002-04-08 1:39 Alexander Terekhov
2002-04-07 15:51 Bossom, John
2002-04-07 6:11 Tim Hutt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E16uDKI-0004a2-00@tungsten.btinternet.com \
--to=tim.hutt@btinternet.com \
--cc=pthreads-win32@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).