function pointers

This is a discussion on function pointers within the C++ Programming forums, part of the General Programming Boards category; CreateThread(NULL,0,&cTunnel::startserver,(LPVOID) 0,NULL,&id[0]); i'm trying to start a thread. 'startserver' is a class method. whats the proper syntax for this? passing ...

  1. #1
    Nor
    Nor is offline
    h ֆhr s Nor's Avatar
    Join Date
    Nov 2001
    Posts
    299

    function pointers

    CreateThread(NULL,0,&cTunnel::startserver,(LPVOID) 0,NULL,&id[0]);

    i'm trying to start a thread.
    'startserver' is a class method.

    whats the proper syntax for this?
    passing a pointer of a class method

    my book says '&std_interface::suspend' but that keeps causing an error.
    Try to help all less knowledgeable than yourself, within
    the limits provided by time, complexity and tolerance.
    - Nor

  2. #2
    Skunkmeister Stoned_Coder's Avatar
    Join Date
    Aug 2001
    Posts
    2,572
    do a board search for "pointers to members". We discussed this at length last week and it has been done many times before.
    Free the weed!! Class B to class C is not good enough!!
    And the FAQ is here :- http://faq.cprogramming.com/cgi-bin/smartfaq.cgi

  3. #3
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Here is one solution.

    Code:
    typedef abc (*pointerXYZ)(...);
    class X
    {
    ...
    static abc XYZ(...);
    ...
    };
    
    pointerXYZ funcPointer = &X::XYZ;
    Kuphryn

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 08:32 AM
  2. Problem with function pointers
    By vNvNation in forum C++ Programming
    Replies: 4
    Last Post: 06-13-2004, 06:49 AM
  3. Staticly Bound Member Function Pointers
    By Polymorphic OOP in forum C++ Programming
    Replies: 29
    Last Post: 11-28-2002, 12:18 PM
  4. Contest Results - May 27, 2002
    By ygfperson in forum A Brief History of Cprogramming.com
    Replies: 18
    Last Post: 06-18-2002, 01:27 PM
  5. function pointers and member functions
    By thor in forum C++ Programming
    Replies: 5
    Last Post: 03-19-2002, 03:22 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21