Recent

Author Topic: Dual platform (Windows/Linux) development  (Read 4496 times)

tech-pro

  • Full Member
  • ***
  • Posts: 173
    • Tech-Pro.net
Dual platform (Windows/Linux) development
« on: February 05, 2008, 11:21:45 am »
I am developing a program that has both Windows and Linux versions from the same source files. I was very impressed that my program developed first under Windows compiled immediately under Linux and worked. Of course, a few platform-specific changes are needed, that can be handled with $IFDEFS. For example, I have to find a Linux replacement for ShellExecute, to launch web pages in the user's browser.

I really would like to have just a single set of source files, and not risk confusion by copying them to Linux to work there, and then copying back to Windows. I have read/write access from Linux to my Windows partition.

Is it practical to compile under two platforms using the same physical copies of the source files?
Julian

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2496
RE: Dual platform (Windows/Linux) development
« Reply #1 on: February 05, 2008, 11:53:57 am »
Thats how I develop lazarus. Sources are located on one fileserver and the same source is used for compiling win32/win64/wince/linux32/linux64/macosx
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

Almindor

  • Sr. Member
  • ****
  • Posts: 411
    • http://www.astarot.tk
RE: Dual platform (Windows/Linux) development
« Reply #2 on: February 05, 2008, 10:47:19 pm »
Having the sources on one "active" disk on which you work from both sides can be a bit troublesome if you don't set things right. Make sure you put your .ppu/.o files in platform specific output dirs otherwise you might get some odd errors out of fpc. (it might try to use a .ppu from different platform, although if that happens then it's a bug)

Btw. if you use TProcess you can avoid stuff like ShellExecute altogether without the ugly ifdefs.

pch

  • Jr. Member
  • **
  • Posts: 51
    • http://ap-i.net
RE: Dual platform (Windows/Linux) development
« Reply #3 on: February 06, 2008, 09:47:32 am »
It is also easy to cross compile  from Linux for Windows by installing the available fpc package.
Then all you need is a XP and/or Vista virtual machine for testing, no more multi boot required.