Return-Path: Delivered-To: apmail-ws-axis-c-user-archive@www.apache.org Received: (qmail 59958 invoked from network); 5 Sep 2008 01:37:54 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 5 Sep 2008 01:37:54 -0000 Received: (qmail 1713 invoked by uid 500); 5 Sep 2008 01:37:52 -0000 Delivered-To: apmail-ws-axis-c-user-archive@ws.apache.org Received: (qmail 1698 invoked by uid 500); 5 Sep 2008 01:37:52 -0000 Mailing-List: contact axis-c-user-help@ws.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: "Apache AXIS C User List" Reply-To: "Apache AXIS C User List" Delivered-To: mailing list axis-c-user@ws.apache.org Received: (qmail 1687 invoked by uid 99); 5 Sep 2008 01:37:52 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 04 Sep 2008 18:37:52 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of dimuthuc@gmail.com designates 209.85.142.184 as permitted sender) Received: from [209.85.142.184] (HELO ti-out-0910.google.com) (209.85.142.184) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Sep 2008 01:36:51 +0000 Received: by ti-out-0910.google.com with SMTP id y6so86477tia.18 for ; Thu, 04 Sep 2008 18:37:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type:references; bh=D4ENTjAK3wIL47IcC2XeKx627U52g9hjzLu//SmxrcU=; b=rrSq1FHikX2XHk/ubeJ7l1CJRLN0j6IXMxj2YgCaYwIJif1p5XLcLSzppqLSlyJwN6 CS2IEVh5X05bQTRjDsNh64BE8Y7jyy5A9fizFXGRCFRkODUbyHuP1b5INstkQOf+2pmu yq+hhQ0Jv1DjQan7NV40+idF9xgdHukui14fE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:references; b=mILHtW3fPxMSvddJaXK/u3ocaXfTzQOjj4foth1sUV/O/JF3B2Yi+ZslVHJ2cMYiSf IiS2S6xRwVy5RZSGvgwVz0v5wlZwyG6IjSwfxtWvMk07Su0MKjOqhNmsxAoNxmkM4s68 VqSIAzk3e34hojViueyGPGKbMpKwvNi1Vee8A= Received: by 10.110.92.8 with SMTP id p8mr14047586tib.25.1220578641094; Thu, 04 Sep 2008 18:37:21 -0700 (PDT) Received: by 10.110.10.6 with HTTP; Thu, 4 Sep 2008 18:37:21 -0700 (PDT) Message-ID: Date: Fri, 5 Sep 2008 07:07:21 +0530 From: "Dimuthu Gamage" To: "Apache AXIS C User List" Subject: Re: forward declaration in generated adb files causes a C++ error In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_109972_32319388.1220578641085" References: X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_109972_32319388.1220578641085 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi Tammy, I m not sure this time your suggestion is a valid one. Just check this header, https://svn.apache.org/repos/asf/webservices/axis2/trunk/c/axiom/include/axiom_attribute.h and the source file, https://svn.apache.org/repos/asf/webservices/axis2/trunk/c/axiom/src/om/om_attribute.c which is the model we should follow in our generated code. There the typedef is done inside the header and the struct declaration is in source. So can you please let us know the error you are getting in this approach? and your platform? In a case you still want to move the struct to the header (it is not a much recomandad approach in c programming), Check the struct declration in the CADBBeanTemplateSource and move that block to CADBBeanTemplateHeader. And you can pack them in the axis2-adb-codegen-xxx.Jar and put in the axis2 java lib directory to load the new library. Thanks Dimuthu On Fri, Sep 5, 2008 at 6:20 AM, Tammy Martin wrote: > Hello Dimuthu, > > Sorry for the delay in response...I tried your fix but unfortunately it did > not work for me. > > It appears that the structure definition and the typedef need to be in the > header file in order for the C++ to compile... > Like this: > > > #include > #include > #include > #include > #include > > struct adb_return > { > axutil_qname_t* qname; > axis2_char_t* property_return; > axis2_bool_t is_valid_return; > }; > /** > * adb_return class > */ > typedef struct adb_return adb_return_t; > > #ifdef __cplusplus > extern "C" > { > #endif > > And there can be NO structure definition in the generated .c file other > wise it is duplicated... > > It doesn't seem to matter if it is in the extern "C" declaration or not.. > > I am getting these errors because I am including the adb_return.h inside my > C++ code. and then I get errors regarding a forward declaraion of struct > adb_return... > > error: invalid use of undefined type `struct adb_return' > > error: forward declaration of `struct adb_return' > > I am trying to fix this by modifying the CADBBeanTemplateHeader.xsl and > CADBBeanTemplateSource.xsl any help you could provide would be greatly > appreciated. > > If there are any other workarounds for this error, compiler flags or > anything I may be missing, please let me know. > > Thanks, > > Tammy > > On 8/25/08, Dimuthu Gamage wrote: >> >> Hi, >> Yea it is a bug, and i just fixed it in the SVN. In fact you can fix it >> without needing to compile the source. >> extract the adb-codegen-*.jar and check >> "org/apache/axis2/schema/template/CADBBeanTemplateHeader.xsl" for a >> template. >> >> >> Thanks >> Dimuthu >> >> >> On Thu, Aug 21, 2008 at 12:28 PM, Tammy Martin > > wrote: >> >>> Hello, >>> >>> I am using axis2c 1.3.0 and axis2 1.4 and used the wsdl2c.sh tool to >>> generate (adb) axis data bindings from a wsdl. I am using these data >>> bindings in a C++ program. When I compile on Linux I get the following >>> error: >>> >>> error: forward declaration of `struct adb_return' >>> >>> this is what it looks like in the header file...it is outside of the >>> extern 'C" declaration. >>> >>> typedef struct adb_return adb_return_t; >>> >>> In order to get this to compile I have to change it to: (which I placed >>> inside of the extern "C" declaration. >>> >>> /** >>> * adb_return class >>> */ >>> typedef struct { >>> axutil_qname_t* qname; >>> axis2_char_t* property_return; >>> axis2_bool_t is_valid_return; >>> } adb_return_t; >>> >>> My question is this, how can I get axis2c to generate databindings that I >>> do not have to manipulate manually in order to compile. Is there an option I >>> am missing on the wsdl2c generation or is there a bug fix that I can obtain? >>> >>> Thanks for your help, >>> Tammy >>> >> >> > -- Thanks, Dimuthu Gamage http://www.dimuthu.org http://www.wso2.org ------=_Part_109972_32319388.1220578641085 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline
Hi Tammy,

I m not sure this time your suggestion is a valid one.

Just check this header, https://svn.apache.org/repos/asf/webservices/axis2/trunk/c/axiom/include/axiom_attribute.h

and the source file, https://svn.apache.org/repos/asf/webservices/axis2/trunk/c/axiom/src/om/om_attribute.c

which is the model we should follow in our generated code. There the typedef is done inside the header and the struct declaration is in source. So can you please let us know the error you are getting in this approach? and your platform?

In a case you still want to move the struct to the header (it is not a much recomandad approach in c programming), Check the struct declration in the CADBBeanTemplateSource and move that block to CADBBeanTemplateHeader. And you can pack them in the axis2-adb-codegen-xxx.Jar and put in the axis2 java lib directory to load the new library.

Thanks
Dimuthu




On Fri, Sep 5, 2008 at 6:20 AM, Tammy Martin <tammymartincali@gmail.com> wrote:
Hello Dimuthu,
 
Sorry for the delay in response...I tried your fix but unfortunately it did not work for me.
 
It appears that the structure definition and the typedef need to be in the header file in order for the C++ to compile...
Like this:
 

#include <stdio.h>
#include <axiom.h>
#include <axis2_util.h>
#include <axiom_soap.h>
#include <axis2_client.h>

struct adb_return
{                  

  axutil_qname_t* qname;
  axis2_char_t* property_return;                      
  axis2_bool_t is_valid_return;                                   
};
/**
   *  adb_return class
   */

typedef struct adb_return adb_return_t;

#ifdef __cplusplus
  extern "C"
        {
 #endif

And there can be NO structure definition in the generated .c file other wise it is duplicated...

It doesn't seem to matter if it is in the extern "C" declaration or not..

I am getting these errors because I am including the adb_return.h inside my C++ code. and then I get errors regarding a forward declaraion of struct adb_return...

error: invalid use of undefined type `struct adb_return'

error: forward declaration of `struct adb_return'

I am trying to fix this by modifying the CADBBeanTemplateHeader.xsl and CADBBeanTemplateSource.xsl any help you could provide would be greatly appreciated.

If there are any other workarounds for this error, compiler flags or anything I may be missing, please let me know.

Thanks,

Tammy

On 8/25/08, Dimuthu Gamage <dimuthuc@gmail.com> wrote:
Hi,
Yea it is a bug, and i just fixed it in the SVN. In fact you can fix it without needing to compile the source.
extract the adb-codegen-*.jar and  check "org/apache/axis2/schema/template/CADBBeanTemplateHeader.xsl" for a template.


Thanks
Dimuthu



On Thu, Aug 21, 2008 at 12:28 PM, Tammy Martin <tammymartincali@gmail.com> wrote:
Hello,
 
I am using axis2c 1.3.0 and axis2 1.4 and used the wsdl2c.sh tool to generate (adb) axis data bindings from a wsdl. I am using these data bindings in a C++ program. When I compile on Linux I get the following error:
 
error: forward declaration of `struct adb_return'
 
this is what it looks like in the header file...it is outside of the extern 'C" declaration.
 
 typedef struct adb_return adb_return_t;
 
In order to get this to compile I have to change it to: (which I placed inside of the extern "C" declaration.
 
 /**
        *  adb_return class
        */
        typedef struct {
          axutil_qname_t* qname;
       axis2_char_t* property_return;
       axis2_bool_t is_valid_return;
        } adb_return_t;
 
My question is this, how can I get axis2c to generate databindings that I do not have to manipulate manually in order to compile. Is there an option I am missing on the wsdl2c generation or is there a bug fix that I can obtain?
 
Thanks for your help,
Tammy





--
Thanks,
Dimuthu Gamage

http://www.dimuthu.org
http://www.wso2.org
------=_Part_109972_32319388.1220578641085--