5 ms·
I wish it had C++ support as well, akin to C++Builder. Pascal syntax is off-putting for many.
by zerr 2y ago
I wish it had C++ support as well, akin to C++Builder. Pascal syntax is off-putting for many.
- lelanthran 2y ago> I wish it had C++ support as well, akin to C++Builder. Pascal syntax is off-putting for many I write my "app" as a library (.dll/.so) in C and use Lazarus to do the GUI, because FFI from FreePascal to C (and back again, for callbacks) is almost transparent.
- zerr 2y agoWell, I like using C++ for UI.
- nazgulsenpai 2y agoHave you ever tried U++? I haven't used it beyond quick and dirty testing but has a decent GUI builder and is a full C++ IDE. https://www.ultimatepp.org/ https://www.ultimatepp.org/
- klaussilveira 2y agoThank you, I did not know about this!
- badsectoracula 2y agoIt'd be neat but that would require a ton of effort and cooperation by several different projects. Basically you'd need a C++ compiler to implement the C++ extensions used by C++ Builder (or something similar if you don't care about C++ Builder compatibility) so that C++ code can use Object Pascal methods with the extra functionality it adds (most important being properties and "published" sections in class declarations that are exposed via RTTI). You'd also need some tool to create C++ bindings for all the Free Pascal units. The above will make possible to use LCL from C++, though only via code. To get the full RAD deal you'd need to implement a C++ parser (including the extensions mentioned above) and refactoring support for Lazarus' CodeTools equivalent to the existing Free Pascal parser/refactoring so that the IDE can autogenerate code (Lazarus doesn't generate separate source code files like some other IDEs with GUI designers do, instead it updates the same source code you are editing on the fly as it keeps a full AST in memory for all edited files and units they depend on - something like that would be needed for C++ too). And yeah, you'd need the people involved with all the above (really mainly the C++ compiler developers) to play along without breaking stuff.
- zerr 2y agoAnother solution could be translating C++ source to Object Pascal before building. It might not be a full C++ but still an acceptable solution.
- badsectoracula 2y agoThat'd only allow you to compile C++ with FPC so you could use the LCL libraries from code, but it wouldn't allow you to use the Lazarus IDE's RAD abilities. And TBH i think it'd be faster to generate a C++ bridge between FPC and C++ and then use G++ to compile the C++ code (you can link .o files to FPC programs, it is how i made Linux binaries for Lazarus programs that use the Qt6 backend and link against Qt6 directly instead of going via the qt-to-pascal bindings library that exposes a C interface for Qt: i link the bridge library statically). FPC has the fcl-pas package which can parse Object Pascal code so the bridge generation could be done automatically. If anything all these would be the (relatively) easy part, the hard part would be parsing C++ so that Lazarus can work with the code in there :-P.
- zerr 2y agoThinking... even code-only usage would be useful I guess, for C++ (like you use wxWidgets/GTK/FLTK). Also, you could visually build the UI in Lazarus, then load in C++ code, if such thing is supported in Lazarus.