I created a simple server that receives an array of four integers, and a corresponding client to send them. These work perfectly when compiled as small, standalone programs. The trouble starts when I link the (same, *exact* ) server code in with a (much) larger app (the povray raytracer). There is different, and wrong behavior when the code is linked as part of the larger app.
I'm linking my server code with the povray raytracer, a fairly large and complex program that links with multiple other libs. However, my code does NOT interact AT ALL with the internals of povray.
In povray's main() I have the all the XmlRpc code do its work before any of the native code even runs. I have the server bind to a specified port and run for a specified time before it quits and the povray code starts.
When the embedded server receives a request to execute its only method, AddTile, and tries to access the params, it returns a fault: type error.
The standalone server, however works correctly. The code in both is the same. The pertinent code is:
for (int i = 0; i<nArgs ; ++i )
{
int v = params[i];
cout<<v<<endl;
}
result = 0;
}
As stated before, this code works perfectly in the standalone version, but throws back a fault: type error when embedded into a larger program. What, in general could be causing such bizarre behaviour?
Looking for some kind of global symbol collision, I tried compiling (with gcc 3.3.4 on redhat9) with -Wshadow and -Wl,--warn-common but haven't seen any meaningful warnings.
Likewise, my attempts to pinpoint the problem with gdb have so far not yielded any results. The key place where the behavior differs is in the line "int v = params[i];" In the standalone server this proceeds normally. But when inside povray the same code causes the XmlRpc library code to take a different path of execution and return a fault for data with TypeInvalid. It is unclear why, however.
One thing I did notice is that many class variables in the xmlrpc++ source code are declared with a leading underscore; a violation of the C++ standard. Variable names with a leading underscore are reserved for the C++ implementation. Could there be some bizarre conflict at work here, with either the standard libraries or the dozens of other libraries linked in with povray? Or am I looking in the wrong place? Any suggestions would be GREATLY appreciated. xmlrpc++ looks very promising, but I've been extremely disappointed and frustrated with this odd behavior.
Thanks,
George
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hey all,
I created a simple server that receives an array of four integers, and a corresponding client to send them. These work perfectly when compiled as small, standalone programs. The trouble starts when I link the (same, *exact* ) server code in with a (much) larger app (the povray raytracer). There is different, and wrong behavior when the code is linked as part of the larger app.
I'm linking my server code with the povray raytracer, a fairly large and complex program that links with multiple other libs. However, my code does NOT interact AT ALL with the internals of povray.
In povray's main() I have the all the XmlRpc code do its work before any of the native code even runs. I have the server bind to a specified port and run for a specified time before it quits and the povray code starts.
When the embedded server receives a request to execute its only method, AddTile, and tries to access the params, it returns a fault: type error.
The standalone server, however works correctly. The code in both is the same. The pertinent code is:
void AddTile::execute( XmlRpcValue& params, XmlRpcValue& result)
{
int nArgs = params.size();
cout<<"params.size(): "<<nArgs<<endl;
for (int i = 0; i<nArgs ; ++i )
{
int v = params[i];
cout<<v<<endl;
}
result = 0;
}
As stated before, this code works perfectly in the standalone version, but throws back a fault: type error when embedded into a larger program. What, in general could be causing such bizarre behaviour?
Looking for some kind of global symbol collision, I tried compiling (with gcc 3.3.4 on redhat9) with -Wshadow and -Wl,--warn-common but haven't seen any meaningful warnings.
Likewise, my attempts to pinpoint the problem with gdb have so far not yielded any results. The key place where the behavior differs is in the line "int v = params[i];" In the standalone server this proceeds normally. But when inside povray the same code causes the XmlRpc library code to take a different path of execution and return a fault for data with TypeInvalid. It is unclear why, however.
One thing I did notice is that many class variables in the xmlrpc++ source code are declared with a leading underscore; a violation of the C++ standard. Variable names with a leading underscore are reserved for the C++ implementation. Could there be some bizarre conflict at work here, with either the standard libraries or the dozens of other libraries linked in with povray? Or am I looking in the wrong place? Any suggestions would be GREATLY appreciated. xmlrpc++ looks very promising, but I've been extremely disappointed and frustrated with this odd behavior.
Thanks,
George