Конференция "KOL" » Another UNICODE_CTRLS issue
 
  • Jon (18.07.10 05:47) [0]
    Still trying to work out Unicode handling in KOL...

    I have a program where I define UNICODE_CTRLS

    This code compiles:


    program Test;

    uses KOL;

    begin
    MessageBox(0,PKOLChar(Int2Str(1)),'',0);
    end.



    with this hint:


    [Warning] Test.dpr(6): Suspicious typecast of String to PWideChar


    But when I add the "Windows" unit:


    program Test;

    uses KOL, Windows;

    begin
    MessageBox(0,PKOLChar(Int2Str(1)),'',0);
    end.



    it does not compile:


    [Warning] Test.dpr(6): Suspicious typecast of String to PWideChar
    [Error] Test.dpr(6): Incompatible types: 'WideChar' and 'Char'


    It is the same if I use KOL.Int2Str

    How can I get it to compile? Should Int2xxx return a KOLString?
  • Ken (18.07.10 14:17) [1]
    use StringToOleStr
  • Дмитрий К © (18.07.10 14:57) [2]

    > The order in which units appear in the uses clause determines
    > the order of their initialization and affects the way identifiers
    > are located by the compiler. If two units declare a variable,
    >  constant, type, procedure, or function with the same name,
    >  the compiler uses the one from the unit listed last in
    > the uses clause. (To access the identifier from the other
    > unit, you would have to add a qualifier: UnitName.Identifier.
    > )


    KOL.MessageBox
  • Jon (18.07.10 16:56) [3]

    >If two units declare a variable, constant, type, procedure, or function with the
    >same name, the compiler uses the one from the unit listed last in the uses clause.


    I thought that it was the other way round. Thank you for that information.
 
Конференция "KOL" » Another UNICODE_CTRLS issue
Есть новые Нет новых   [134430   +3][b:0][p:0.001]