How to share a project between Delphi and Lazarus? lazarus / 13-General ---------------------------------------------------------------------- JazzMan · 2007-11-01 14:28 I find Lazarus very interesting because it allows me to make a Mac version of my application. I would however prefer to continue using Delphi for the Windows side, but the .dfm files are called .lfm in Lazarus, and maybe there are other complications. My question is if it is possible to share a project, including forms, between Delphi and Lazarus? Best regards, Hans ---------------------------------------------------------------------- felipemdc · 2007-11-01 14:33 The dfm/lfm files are incompatible, and don't accept ifdefs. This is the greatest problem I found. I see 2 good solutions: 1 - Don't use the form designer, so you never edit the lfm/dfm files, and therefore there is no incompatibility. All gui elements can be created on code. Take a look at the source of the magnifier to see a real life project that uses this approach: http://sourceforge.net/projects/magnifier 2 - Create a tool that will convert lfm files to dfm and vice-versa. It should have a table of properties that each doesn't support and those are removed on the conversion. If you edit a form on delphi, then run the tool to update the lfm file. If you edit a form on lazarus, run the tool to update the dfm file. Althougth something of good use, no-one has already built such tool. If you do, please release the source so others can benefit from it =) ---------------------------------------------------------------------- Phil · 2007-11-01 14:44 Quote from: "JazzMan"I find Lazarus very interesting because it allows me to make a Mac version of my application. I would however prefer to continue using Delphi for the Windows side, but the .dfm files are called .lfm in Lazarus, and maybe there are other complications. My question is if it is possible to share a project, including forms, between Delphi and Lazarus? Yes, you can compile the same code on both. Use this tool to keep your .lfm fies up to date when you make changes to .dfm's on the Delphi side: http://wiki.lazarus.freepascal.org/XDev_Toolkit The DfmToLfm tool has a DfmToLfm.ini file that lists the properties not supported by the Lazarus LCL and strips these properties from the .dfm file when creating the .lfm file. You can add to this file as needed (for example, if you're using custom controls). Thanks. -Phil ---------------------------------------------------------------------- JazzMan · 2007-11-02 11:07 Thank you very much, it looks promising. I might leave Delphi and move completely to Lazarus at a later time, but so far I still find Delphi more smooth to work with. Best regards, Hans ---------------------------------------------------------------------- Phil · 2007-11-02 13:21 Quote from: "JazzMan"Thank you very much, it looks promising. I might leave Delphi and move completely to Lazarus at a later time, but so far I still find Delphi more smooth to work with. Yes, if you have a recent version of Delphi it probably makes sense to continue using it with Windows. You can also run your code through the Windows version of Lazarus to find additional bugs, different compiler hints and warnings, etc. The more compilers and platforms you test your code on, the better it will be. Thanks. -Phil ---------------------------------------------------------------------- Marc · 2007-11-02 14:10 Just a note on conversions. The internal graphic formats used by the VCL and the LCL might differ. When reading a source created by Delphi, the lcl will convert it to the LCL internal format. This means that a DFM/strippedDFM can be read by Lazarus, but not the other way. ---------------------------------------------------------------------- Phil · 2007-11-02 14:37 Quote from: "Marc"Just a note on conversions. The internal graphic formats used by the VCL and the LCL might differ. When reading a source created by Delphi, the lcl will convert it to the LCL internal format. This means that a DFM/strippedDFM can be read by Lazarus, but not the other way. The other issue with lfm-->dfm is that there's no way to restore the stripped properties to the dfm file. That's not a problem if they're the same as the defaults, but if you originally had set any to non- default values in Delphi (e.g., fonts in controls that don't have the Font property in LCL) this information would be lost in moving a Laz- saved lfm back to Delphi. But if (1) you don't care about the stripped properties (some are obsolete anyway) and (2) don't have graphics in the form, then simply renaming the lfm to dfm should work and a converter probably isn't necessary. Thanks. -Phil ---------------------------------------------------------------------- Marc · 2007-11-02 15:06 LCL has some properties the VCL doesnt have ---------------------------------------------------------------------- JazzMan · 2007-11-05 08:04 Yes, both VCL and LCL has properties not found in the other library. I would only use it one way, so all editing happens in Delphi and the conversion to .lfm is for compilation only. However, it looks like there could be complications depending on the actual code so I will we what the practical experience brings. Best regards, Hans