Hi Zoltan,

I've done your proposed change. Thanks for pointing this out, this case
completely run unnoticed while I've been doing const string typedef
unaliasing fix in the past.

Thanks,
Karel

> Zoltan Bordas wrote:
>> I ran into some IDL compilation problems using the MICO 2.3.12-VC8
>> distribution. It looks like there are a few changes have been applied
>> to the windows specific baseline compared to the original UNIX version
>> to support wstring types.
>>
>>  
>>
>> There is a problem that shows up when the IDL looks similar to this:
>>
>>  
>>
>> module CosPropertyService
>>
>> {
>>
>>    /** A PropertyName is a string. */
>>
>>    typedef string PropertyName;
>>
>> ….
>>
>>  
>>
>> And we reference to it like this:
>>
>>  
>>
>>       /**
>>
>>        * well bores contained in this well
>>
>>        */
>>
>>       const CosPropertyService::PropertyName PROP_BORES = "bores";
>>
>>  
>>
>>  
>>
>> The generated code will end up having a const mismatch as the header
>> file will declare PROP_BORES with type PropertyName but the cpp file
>> will un-alias it to const char* const and is causing a compiler error
>> in MSDEV.
>>
>>  
>>
>> In order to fix this problem we need to apply the same change to
>> "codegen-c++-stub.cc" that has already been made to
>> "codegen-c++-common.cc":
>>
>>  
>>
>> Method emit_Constant( CORBA::ConstantDef_ptr c ):
>>
>>  
>>
>> Instead of:
>>
>>  
>>
>>     emit_type_for_variable (type, manual);
>>
>>  
>>
>>     if (tc->kind() == CORBA::tk_string
>>
>>       || tc->kind() == CORBA::tk_wstring) {
>>
>>       // special handling of string constants
>>
>>       o << " const";
>>
>>     }
>>
>>  
>>
>> do:
>>
>>  
>>
>>     // special handling of string/wstring constants
>>
>>     if (tc->unalias()->kind() == CORBA::tk_string) {
>>
>>         o << "char* const";
>>
>>     }
>>
>>     else if (tc->unalias()->kind() == CORBA::tk_wstring) {
>>
>>         o << "CORBA::WChar* const";
>>
>>     }
>>
>>     else {
>>
>>         emit_type_for_variable (type, manual);
>>
>>     }
>>
>>  
>>
>> I think the fix is obvious and does not need further explanation. The
>> 2 files need to be in sync.
>>
>>  
>>
>> See attached files (full source and patch file).
>>
>>  
>>
>> Many thanks:
>>
>>  
>>
>> Zoltan Bordas
>>
>> Senior Software Engineer
>>
>> OpenSpirit Corporation
>>
>> www.openspirit.com <http://www.openspirit.com>
>>
>> +1 281.295.1426 direct
>>
>> +1 281.295.1401 fax
>>
>>  
>>
> 


-- 
Karel Gardas                  [EMAIL PROTECTED]
ObjectSecurity Ltd.           http://www.objectsecurity.com
_______________________________________________
Mico-devel mailing list
Mico-devel@mico.org
http://www.mico.org/mailman/listinfo/mico-devel

Reply via email to