I'm trying to add xml-rpc to an existing application using http://xmlrpc-c.sourceforge.net/ .I used the following code for testing.

xmlrpc_c::clientSimple myClient;
xmlrpc_c::value result;
	
myClient.call(serverUrl, methodName, "ii", &result, 5, 7);
int const sum((xmlrpc_c::value_int(result)));

The code compiles correctly, but causes the program to throw an error. If I initialize them as pointers, the problem goes away.

xmlrpc_c::clientSimple* myClient;
xmlrpc_c::value* result;

I do not know how to handle the rest of the code. To make it work with the pointers.

instead of the dot operator use pointer operator

myClient->call(serverUrl, methodName, "ii", &result, 5, 7);

But make sure the pointer is a valid pointer -- it has to be initialized to something before the above line can be successfully executed.

myClient = new xmlrpc_c::clientSimple;

Thank you for the clarification. I remember using that in my code at one point in the afternoon, but I was very unsure of myself. So I tried every iteration I could google.

I think the problem is more complex than I thought it was. The new code still causes errors.

myClient = new xmlrpc_c::clientSimple;
result = new xmlrpc_c::value;

Both throw errors when the program loads the module. Specifically error ( undefined symbol: _ZN8xmlrpc_c5valueC1Ev) Are there any tricks to prevent these memory/pointer conflicts?

I am thinking that I need template xml-rpc into its own loadable module. And just pass the method name, and values to that module.

Its kind of a crash course, I just picked up c++ 2 months ago. But, I did take one c++ class in 1999.

undefined symbol indicates the compiler does not know what that smbol is -- it has not been declared in any of the header files or before it was used. I suspect your program may be missing a header file or a macro of some kind. Search the header file where you THINK it is supposed to be defined to see that it really is there. If its there then check if there is a conditional macro, might be something like this:

#ifdef _WIN32
// define the symbol here
#endif
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.