简体   繁体   中英

gsoap linux c++ / struct failure delivery

char or int, return value is passed well.

But struct is passed to fail.

server:

soapcpp2 -2 -SLix ...

client:

wsdl2h -f -s -o ... ...
soapcpp2 -i -C ...

and

struct{
  char * value;
}USER_ITEM

server:

int Service::GetValue(struct USER_ITEM * item)
{
  item->value = new char[100];
  item->value = "example";
}

client:

....
ns2__useritemresponse user;
proxy.Getvalue(user)
user.user_item->value  // user.user_item address is null;
....

The windows are good. But not on Linux c++.

Are in the same format as above.

Do I need a separate set of options?

Please help if you suspect parts.

Sorry, I did not speak English well.

Thanks for reading.

You cannot copy a char pointer by using the assignment operator, this is not an std::string:

item->value = new char[100];
strcpy(item->value, "example");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM