Why does this not work?

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

Received on Tuesday, 30 April 2002 19:35:56 UTC