axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dimuthu Gamage" <dimut...@gmail.com>
Subject Re: forward declaration in generated adb files causes a C++ error
Date Wed, 10 Sep 2008 02:31:20 GMT
On Wed, Sep 10, 2008 at 5:19 AM, Tammy Martin <tammymartincali@gmail.com>wrote:

> Hello Dimuthu,
>
> I finally figured out what my problem was...
>
> The axis2c adb are generating just fine it was my error in not knowing how
> to use them...sorry.
>
> I did not see that there were access methods defined in the header file to
> get access to the items in the struct.
>
Yea. You should use this accessors and not struct members directly. Nice to
hear you got out of the problem. :)

Dimuthu

>
> Thanks for your help,
> Tammy
>
> On Thu, Sep 4, 2008 at 6:37 PM, Dimuthu Gamage <dimuthuc@gmail.com> wrote:
>
>> 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
>>
>
>


-- 
Thanks,
Dimuthu Gamage

http://www.dimuthu.org
http://www.wso2.org

Mime
View raw message