Skip to main content

Problem:

  • Product Name: VisiBroker
  • Product Version: 7.0
  • Platform/OS Version: Windows
  • Compiler: Borland C Builder 2006 (enabled for certain customer), Microsoft Visual C

How to resolve compiler error on idl2wsc-generated multiple declarations from IDL's typedef struct

Basically, idl2wsc generated multiple declarations from WebService IDL's typedef-ed struct causing compilation error.

  1. Go to $VBROKERDIR/examples/vbroker/ws/bank

  2. Edit BankWebService.idl to:
    module BankWebService{
    // Added - Begin
    typedef struct CS_StringS {
      string value;
      boolean isDefined;
      boolean isNull;
    }; CS_String;
    // Added - End

    interface AccountManagerWebService {
      // opens account if not already opened, and returns balance
        float openAndQueryBalance (in string name);
      };
    };

  3. Compile the application with : 'nmake cpp

  4. Expect the multiple declaration of VISWebService::Axis_URI_BankWebService_CS_StringS, prompting compilation error as follows:

    idl2wsc -src_suffix cpp -IC:\\Borland\\VisiBroker\\idl -gen_cpp_bridge BankWebService.idl
    CL /nologo /MD /DTHREAD /D_VIS_STD -DWIN32 /EHsc /DSTRICT /DALIGNED -I. -IC:\\Borland\\VisiBroker\\include -IC:\\Borland\\VisiBroker\\include\\stubs /Zc:wchar_t -c /Tp BankWebService_ws_s.CPP
    BankWebService_ws_s.CPP
    c:\\borland\\visibroker\\examples\\vbroker\\ws\\bank\\BankWebService_ws_s.hh(46) : error C2370: "VISWebService::Axis_URI_BankWebService_CS_StringS" : redefinition; different storage class
    c:\\borland\\visibroker\\examples\\vbroker\\ws\\bank\\BankWebService_ws_s.hh(30) : see declaration of "VISWebService::Axis_URI_BankWebService_CS_StringS"
    c:\\borland\\visibroker\\examples\\vbroker\\ws\\bank\\BankWebService_ws_s.hh(47) : error C2370: "VISWebService::Axis_TypeName_BankWebService_CS_StringS" : redefinition; different storage class
    c:\\borland\\visibroker\\examples\\vbroker\\ws\\bank\\BankWebService_ws_s.hh(31) : see declaration of "VISWebService::Axis_TypeName_BankWebService_CS_StringS"
    c:\\borland\\visibroker\\examples\\vbroker\\ws\\bank\\BankWebService_ws_s.hh(50) : error C2011: "VISWebService::BankWebService_CS_StringS" : "class" type redefinition
    c:\\borland\\visibroker\\examples\\vbroker\\ws\\bank\\BankWebService_ws_s.hh(34) : see declaration of "VISWebService::BankWebService_CS_StringS"
    BankWebService_ws_s.CPP(29) : error C2027: use of undefined type "VISWebService::BankWebService_CS_StringS"
    c:\\borland\\visibroker\\examples\\vbroker\\ws\\bank\\BankWebService_ws_s.hh(34) : see declaration of "VISWebService::BankWebService_CS_StringS"
    BankWebService_ws_s.CPP(29) : fatal error C1903: unable to recover from previous error(s); stopping compilation
    NMAKE : fatal error U1077: ""C:\\Program Files\\Microsoft Visual Studio 8\\VC\\BIN\\CL.EXE"" : return code "0x2"
    Stop.
    NMAKE : fatal error U1077: ""C:\\Program Files\\Microsoft Visual Studio 8\\VC\\BIN\\nmake.exe"" : return code "0x2"
    Stop.

Resolution:

The typedef-ed struct issue for idl2wsc is not yet implemented and an enhancement CR 9955 is filed.

typedef is aliases to the actual type definition for better readability. The issue can be resolved by not defining the typedef. It does not affect the run-time performance of your VisiBroker implementation.


Author: Mark Dultra

BankWebService.idl
Old KB# 29715

#VisiBroker
#webservice
#Security
#C
#c