Why does this not work?

"Michael Labhard" <[email protected]>
Newsgroups gmane.comp.lib.libwww
Message-ID <000a01c1f09f$c5250ad0$0f64adcf@homeke6pijupjp>
This class, when used to send more than 6 sets of data on my machine results
in a core dump using Windows XP Pro and cygwin.

#include <xmlrpc.h>
#include <xmlrpc_client.h>

#define NAME "Test"
#define VERSION "0.1"

class BadXmlRpc
{
 public:
    BadXmlRpc()
    {
        ::xmlrpc_client_init(XMLRPC_CLIENT_NO_FLAGS, NAME, VERSION);
    };
    ~BadXmlRpc()
    {
        ::xmlrpc_client_event_loop_end();
        ::xmlrpc_client_cleanup();
    }
    void SendData(char *data)
    {
        ::xmlrpc_client_call_asynch( http://localhost:8080:/RPC2,
"mymethod", 0, "(s)", data);
        ::xmlrpc_client_event_loop_finish_asynch_timeout( 200 );
    }
}

But this class works:

class GoodXmlRpc
{
public:
    void SendData(char *data)
    {
        ::xmlrpc_client_init(XMLRPC_CLIENT_NO_FLAGS, NAME, VERSION);

        ::xmlrpc_client_call_asynch( http://localhost:8080:/RPC2,
"mymethod", 0, "(s)", data);
        ::xmlrpc_client_event_loop_finish_asynch_timeout( 200 );

        ::xmlrpc_client_event_loop_end();
        ::xmlrpc_client_cleanup();
    }
}

Why cannot the initializtion and cleanup occur once for multiple asynch
calls and event loops?

-- Michael
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.