Hi Zoltan,
Using this piece of IDL code I am not able to reproduce your error.
module Test {
typedef sequence<long> LongSeq;
/** A PropertyName is a string. */
typedef string PropertyName;
};
Generated code:
typedef char* PropertyName;
typedef CORBA::String_var PropertyName_var;
typedef CORBA::String_out PropertyName_out;
extern CORBA::TypeCodeConst _tc_PropertyName;
I created a small test program:
#include "test.h"
typedef char* XString;
void func()
{
const Test::PropertyName PROP_BORES = "bores";
const XString x = "abc";
}
The above statements are identical and they both compile perfectly.
I have compiled with VSTUDIO :NET (2oo3 edition) because I didn't
install yet the 2005 version.
Could you please run the test above with VSTUDIO 2005 ?
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
--
Best regards,
Sorin Mustaca
http://www.mustaca.de
_______________________________________________
Mico-devel mailing list
Mico-devel@mico.org
http://www.mico.org/mailman/listinfo/mico-devel