AnsiString must be supported?

Issue #92 resolved
German Gentile created an issue

I dont undertsand if AnsiString is compatible or dont with CrossVcl. I try a simple vcl form with a simple button:

procedure TForm2.Button1Click(Sender: TObject); var aString : AnsiString; begin aString := 'Holá'; Showmessage(aString); end;

[DCC Error] Unit2.pas(30): E2010 Incompatible types: 'Pointer' and 'string' [DCC Error] Unit2.pas(31): E2010 Incompatible types: 'string' and 'Pointer'

Comments (11)

  1. German Gentile reporter

    Eugene, In a delphi console app.

    This:

    var aString : AnsiString;

    Compile ok for win32 compiler.

    but Fail for linux compiler

    [DCC Error] Project3.dpr(12): E2003 Undeclared identifier: 'AnsiString'

    So, i understand you use the linux compiler on CrossVcl and then is not possible to support AnsiString. The problem is almost all the thirdy party developers and libraries stands on AnsiString. That is the response to your question on WHY to use AnsiStrings. I see a big problem comming here.

    Or im wrong?

  2. Eugene Kryukov repo owner

    AnsiString is not main issue with third-party i guest. There are lot of issues with old-vcl components and new Delphi compiler. Unfortunately we can't resolve it.

  3. Eugene Kryukov repo owner

    The point that third-party vendors should think about it and make it's tools more flexible. And you can help with that.

  4. Eugene Kryukov repo owner

    In latest version AnsiString and AnsiChar types should work. We added aliases to Utf8String and Utf8Char.

  5. German Gentile reporter

    Great news! Im trying to test now but for some reason my project havent Linux platffotm and the add new platform menu is not there anymore. With new projects is there. Seems like some flag in the projects becomes crazy? How to clean the old project config to allow to add again the linux plattform?

  6. Eugene Kryukov repo owner

    Yes, right now new platform can be added only to just Windows VCL project. We are working on fixing it.

  7. German Gentile reporter

    Ok, i remove by hand osx references and works now. Will try and tell you later. Best regards

  8. German Gentile reporter

    Ok, now Ansistrings are recognized but seems like you must add the Winapi.Windows unit to the uses list. Not bideal at all, just to know, theres any global define i can use for crossvcl?

    Some like

    {$IFDEF CROSSVCL} Winapi.Windows

    Let me know.

  9. Eugene Kryukov repo owner

    There is no way to declare project based directive. Add Winapi.Windows is one of better way to add support for missing features.

  10. Log in to comment