Discussion:
string in idl struct autogenerating an unwanted "*" elsewhere
(too old to reply)
c***@aol.com
2013-08-29 13:36:19 UTC
Permalink
Even though I have 6 great books on IDL, I know almost nothing about IDL. Although, I can state the following as fact.

Briefly, how do I add a string variable to an idl struct without autogenerating a "*" in a virtual function?

The details are the following.

(1) Among additional pre-existing code, I have the below struct in an idl file. The resulting code works perfectly after compilation, etc.

struct office
{
//...
}

When I run my idl to C++ compiler on that idl file etc, I get (among other things) the below code in an autogenerated dot h C file.

virtual ::Level1::Room1 office getworker (::Level1::Cubicle number8d) = 0;

(2) I've been assigned the task of adding a new "string" variable to the struct in the above working code.

Consequently, the struct will become:

struct office
{
//...
string test;
}

When I run my idl to C++ compiler on that modified idl file, I get (among other things) the below code in an autogenerated dot h C file. Notice the new "*"!

virtual ::Level1::Room1 office * getworker (::Level1::Cubicle number8d) = 0;

(3) As you can imagine, the above "*" is unwanted because it produces a lot of compile error message. So, how can I add the string (as in 2 above) without autogenerating the "*" seen in 2 above. I want a better solution than converting the string variable to an array of char. I tried typedefing the string, but that did not work.

Thank you,
Johnny Willemsen
2013-08-30 11:18:39 UTC
Permalink
Hi,

The behavior you describe is by design in the IDL to C++ language
mapping. If you check the IDL to C++ language mapping (see
http://www.omg.org/spec/CPP/1.3/PDF), section 5.24.1 Operation
Parameters and Signatures you can read about fixed and variable size types.

By introducing the string as member you are changing your type from
fixed size to variable size which changes the out and return mapping of
your struct.

If you extend your struct in a way that it keeps of a fixed size the
passing rules stay the same.

The new IDL to C++11 language mapping doesn't have this, you can find
that spec online at http://www.omg.org/spec/CPP11/. At this moment
TAOX11 is the only product implementing it, see www.theaceorb.nl

Best regards,

Johnny Willemsen
Remedy IT
Post by c***@aol.com
Even though I have 6 great books on IDL, I know almost nothing about IDL. Although, I can state the following as fact.
Briefly, how do I add a string variable to an idl struct without autogenerating a "*" in a virtual function?
The details are the following.
(1) Among additional pre-existing code, I have the below struct in an idl file. The resulting code works perfectly after compilation, etc.
struct office
{
//...
}
When I run my idl to C++ compiler on that idl file etc, I get (among other things) the below code in an autogenerated dot h C file.
virtual ::Level1::Room1 office getworker (::Level1::Cubicle number8d) = 0;
(2) I've been assigned the task of adding a new "string" variable to the struct in the above working code.
struct office
{
//...
string test;
}
When I run my idl to C++ compiler on that modified idl file, I get (among other things) the below code in an autogenerated dot h C file. Notice the new "*"!
virtual ::Level1::Room1 office * getworker (::Level1::Cubicle number8d) = 0;
(3) As you can imagine, the above "*" is unwanted because it produces a lot of compile error message. So, how can I add the string (as in 2 above) without autogenerating the "*" seen in 2 above. I want a better solution than converting the string variable to an array of char. I tried typedefing the string, but that did not work.
Thank you,
Loading...