soapcpp2 does not recognize symbol visibility decls
Development toolkit for Web Services and XML data bindings for C & C++
Brought to you by:
engelen
input.h:
struct foo { int bar; foo(int x); };
When I just leave it at that, the struct/class is not visible to other DLLs (but which I would like). None of struct SOAP_CMAC foo {
(or the __declspec
or __attribute__(visibility(...))
variants) are recognized by soapcpp2 (gsoap 2.8.37) and yield a parse error:
$ soapcpp2 -z1 -x i.h ** The gSOAP code generator for C and C++, soapcpp2 release 2.8.37 ** Copyright (C) 2000-2016, Robert van Engelen, Genivia Inc. ** All Rights Reserved. This product is provided "as is", without any warranty. ** The soapcpp2 tool and its generated software are released under the GPL. ** ---------------------------------------------------------------------------- ** A commercial use license is available from Genivia Inc., contact@genivia.com ** ---------------------------------------------------------------------------- i.h(2): **ERROR**: struct 'SOAP_CMAC' has incomplete type (if this struct is not serializable then declare 'extern struct SOAP_CMAC') i.h(3): Syntax error: undefined type in declaration of 'bar' i.h(4): **ERROR**: last output parameter of service operation function prototype 'foo' is a return parameter and must be a pointer or reference, or use foo(..., void) for one-way sends [...]
More to the point: I recognize that .h input files to soapcpp2 are not valid C/C++ anyway (because e.g.
struct ns:foo
is possible), but it would be nice if soapcpp2 emitted SOAP_CMAC for the files it does generate.struct foo
would reappear insoapStub.h
for example, that's where SOAP_CMAC would be worth having.soapcpp2 accepts C/C++ syntax with few limitations, but does not expand macros. Use a C++ preprocessor for that. Perhaps use 'sed' on the source code output as a last resort.
The problem does not go away by using a C++ preprocessor. If
input.h
'sstruct SOAP_CMAC mystruct {...}
is turned intostruct mystruct {...}
by way of a preprocessor to satisfy soapcpp2's stricter requirements, then the generatedsoapStub.h
has no SOAP_CMAC marker either.Perhaps this helps to narrow down the question-answers:
SOAP_CMAC
(already implemented): useclass
instead ofstruct
.