axis-c-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alebu <ale...@gmail.com>
Subject WSDL2C: structure definition is generated in C file so sizeof fails compilation
Date Mon, 21 Apr 2008 12:38:19 GMT
Hi, I am generating web service using WSDL2C. In generated code I got such a
division of sources:
In header (.h) file i got type declaration like:
typedef struct adb_my_type adb_my_type_t;

But adb_my_type structure is located in source file (.c):
struct adb_my_type {
   // declaration of my_type
};

Such a location of sources creates a problem when I trying to allocate
memory for such a structure.
sizeof(adb_my_type_t) fails with incomplete type ...
As I understand, it happens because compiler can't discover exact size of
structure from header, because actual information
is available only from source file.
I moved declaration to header like:
struct adb_my_type {
   // declaration of my_type
};
typedef struct adb_my_type adb_my_type_t;

And now everything works fine, so I think that it is better to generate code
in such way.
Or maybe there is some motivation to do it like it is made for now?
If so, then what is that motivation? And how then to get size of structure?
I think It is code generator bug so thats why I actually write that letter.

Mime
View raw message