The result field in your structure is a pointer to int
. In your code, you
first initialize it to 0
, then attempt to assign a value through that pointer.
But on most systems, that will fail, because the memory at address 0 hasn't been
allocated to your program.
The fix is to ensure that result
points to valid memory before attempting
to assign through that pointer. Exactly how that should happen depends on
how that structure is going to be used in your code. One way would be to
declare an int
variable outside of your function (probably at file scope),
then take its address and assign it to result
:
int my_result; // This should be declared OUTSIDE of a function!
int __ns3__PersonRequest(soap *, _ns1__PersonRequest *ns1__PersonRequest, _ns1__PersonRequestResponse *ns1__PersonRequestResponse)
{
ns1__PersonRequestResponse->result = &my_result; // Make sure pointer points to valid memory
*ns1__PersonRequestResponse->result = 39; // Updates the value of my_result
return SOAP_OK;
}