Menu

#1077 soapcpp2 does not recognize symbol visibility decls

v1.0 (example)
closed
None
5
2016-11-08
2016-11-06
No

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
[...]

Discussion

  • Jan Engelhardt

    Jan Engelhardt - 2016-11-06

    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 in soapStub.h for example, that's where SOAP_CMAC would be worth having.

     
  • Robert van Engelen

    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.

     
  • Robert van Engelen

    • status: open --> closed
     
  • Jan Engelhardt

    Jan Engelhardt - 2016-11-07

    The problem does not go away by using a C++ preprocessor. If input.h's struct SOAP_CMAC mystruct {...} is turned into struct mystruct {...} by way of a preprocessor to satisfy soapcpp2's stricter requirements, then the generated soapStub.h has no SOAP_CMAC marker either.

     
  • Robert van Engelen

    Perhaps this helps to narrow down the question-answers:

    1. expanding macros in a .h file for soapcpp2? Use a preprocessor.
    2. generating class decls with SOAP_CMAC (already implemented): use class instead of struct.
    3. or perhaps additional syntax for soapcpp2 to accept DLL decls?
     

Log in to post a comment.