‹ BackHN Continuity

Thread

EDG C++ front-end goes public

249 points · 129 comments · iandinwoodie

  1. badsectoracula · · focus · HN ↗
    I wonder if the source-to-source compilation could be used to transpile C++ code/libraries to other languages - e.g. could this be used (with appropriate modifications of course) to compile FLTK into Free Pascal code and used directly by Lazarus as a backend for LCL? Trying to use C++ libraries from non-C++ is always a PITA, especially if you want to avoid dynamic linking.

    Also, since i mentioned Lazarus, if it can compile itself to Free Pascal, i wonder if it'd be useful for adding C++ support to Lazarus itself so that Free Pascal and C/C++ can be mixed in a project to make self-contained executables for desktop applications. It'd most likely need much more work than that just the compilation to make it a first class citizen like Free Pascal itself is for Lazarus/LCL (e.g. things like the object inspector and code tools being able to understand C++ well enough so that refactoring and stuff like doubleclicking on a button in a form automatically declaring and defining the handler and moving the editor cursor to the newly defined handler's code body), but maybe it could be used as a starting point.

    1. coliveira · · focus · HN ↗
      Borland compilers used to allow the mixing of C++ and Pascal code, so it is technically possible.
      1. badsectoracula · · focus · HN ↗
        Well, Borland had the benefit of being in control of both compilers :-). C++ Builder even had Object Pascal compatible extensions to link against VCL (which was written in Pascal).

        You can already mix Free Pascal with C/C++ code if you use the same linker and libraries - i did manage to get FLTK statically linked with an initial backend for Lazarus in fact - this shot[0] shows a form and a few buttons from a self-contained binary on Linux (it links against FLTK statically and X11/etc dynamically).

        But it is a PITA to get working for C++ libraries specifically (and you need a C intermediate for FPC to use). Also i couldn't get it to work for Win32, only Linux.

        [0] <a href="http:&#x2F;&#x2F;runtimeterror.com&#x2F;pages&#x2F;iv&#x2F;images&#x2F;8a6ff400ed9b0d424be8da2bf0b1f014.png" rel="nofollow">http:&#x2F;&#x2F;runtimeterror.com&#x2F;pages&#x2F;iv&#x2F;images&#x2F;8a6ff400ed9b0d424be...

        1. coliveira · · focus · HN ↗
          Borland made the virtual tables used by C++ and ObjPascal compatible, that&#x27;s why it was possible to mix the two languages. If the design is different than it becomes a much more difficult problem.
          1. [deleted] · · focus · HN ↗

            [deleted]

      2. pjmlp · · focus · HN ↗
        They still do, only it is Embarcadero now.

        <a href="https:&#x2F;&#x2F;www.embarcadero.com&#x2F;products&#x2F;rad-studio" rel="nofollow">https:&#x2F;&#x2F;www.embarcadero.com&#x2F;products&#x2F;rad-studio

Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.