Discussion:
[fpc-pascal] {$R file} support on non-Windows targets
Craig Peterson
2008-07-09 16:59:20 UTC
Permalink
Does any version of FPC support the {$R file} syntax for resources on
non-Windows targets? I'd prefer that to Lazarus's LResources unit. I
have the impression that some work on it was done as part of Simon
Kissel's CrossFPC project, but I haven't been able to verify that. Was
work done and never completed? Is it a TODO that just doesn't have
anyone to work on it?

Thanks,
Craig Peterson
Scooter Software
Michael Van Canneyt
2008-07-09 17:20:37 UTC
Permalink
Post by Craig Peterson
Does any version of FPC support the {$R file} syntax for resources on
non-Windows targets? I'd prefer that to Lazarus's LResources unit. I have
the impression that some work on it was done as part of Simon Kissel's
CrossFPC project, but I haven't been able to verify that. Was work done and
never completed? Is it a TODO that just doesn't have anyone to work on it?
All targets in 2.3.1 now support {$R file} syntax.

Michael.
Felipe Monteiro de Carvalho
2008-07-09 18:08:35 UTC
Permalink
On Wed, Jul 9, 2008 at 2:20 PM, Michael Van Canneyt
Post by Michael Van Canneyt
All targets in 2.3.1 now support {$R file} syntax.
So I assume we have a cross-platform resource compiler now, so is
windres unnecessary? Was pre-processing also implemented?

Also, how do you access the resources? With TResourceStream?

thanks,
--
Felipe Monteiro de Carvalho
Giulio Bernardi
2008-07-09 18:17:09 UTC
Permalink
Post by Felipe Monteiro de Carvalho
On Wed, Jul 9, 2008 at 2:20 PM, Michael Van Canneyt
Post by Michael Van Canneyt
All targets in 2.3.1 now support {$R file} syntax.
So I assume we have a cross-platform resource compiler now, so is
windres unnecessary? Was pre-processing also implemented?
No. To compile .rc files to .res you still need windres. In general you
can compile and run it fine on little endian machines, but it doesn't
work (at least, it didn't work 6 months ago, don't know if newer
versions are endian safe) on big endian machines.
So there is still no .rc compiler. However the 2.3.1 fpcres is able to
compile dfm/lfm/xfm files.
Post by Felipe Monteiro de Carvalho
Also, how do you access the resources? With TResourceStream?
With RTL functions like FindResource, LoadResource and so on.
TResourceStream uses these functions.

Giulio
Graeme Geldenhuys
2008-07-10 06:51:18 UTC
Permalink
Post by Felipe Monteiro de Carvalho
So I assume we have a cross-platform resource compiler now, so is
windres unnecessary? Was pre-processing also implemented?
No. To compile .rc files to .res you still need windres. In general you can
compile and run it fine on little endian machines, but it doesn't work (at
least, it didn't work 6 months ago, don't know if newer versions are endian
safe) on big endian machines.
So is that the technical issue with cross-platform resource compilers?
The endian handling? Or is there some other technical issue? I
remember even Kylix didn't have a resource compiler and couldn't
understand why. After all, most C/C++ compilers are cross platform
and they seem to have resource compilers, so what is wrong with Object
Pascal compilers...

Sorry if this is dumb, but I obviously don't understand the full issue here...


Regards,
- Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
Giulio Bernardi
2008-07-10 07:13:31 UTC
Permalink
Post by Graeme Geldenhuys
Post by Felipe Monteiro de Carvalho
So I assume we have a cross-platform resource compiler now, so is
windres unnecessary? Was pre-processing also implemented?
No. To compile .rc files to .res you still need windres. In general you can
compile and run it fine on little endian machines, but it doesn't work (at
least, it didn't work 6 months ago, don't know if newer versions are endian
safe) on big endian machines.
So is that the technical issue with cross-platform resource compilers?
The endian handling? Or is there some other technical issue? I
remember even Kylix didn't have a resource compiler and couldn't
understand why. After all, most C/C++ compilers are cross platform
and they seem to have resource compilers, so what is wrong with Object
Pascal compilers...
Sorry if this is dumb, but I obviously don't understand the full issue here...
The concept of "resources" is a bit vague when talking about different
platforms. Some systems have this concept, some no, and they are all
different things, though the basic thing that they provide is a way to
embed data in applications.
E.g. windows has it's own definition of resources, classic Mac OS
another, Mac OS X another, OS/2 another one, Unix doesn't have
"resources", and so on. So a "cross platform resource compiler" is not
common because there isn't a standardized resource format.
In 2.3.1 we support resources "the windows way" on non-windows systems:
the 2.3.1 fpcres is able to convert .res files to object files which
will be linked in your application. However we don't have a resource
compiler yet (a compiler that is able to compile .rc files to .res
files). There is gnu windres though which is able to do this work.
Windres can also be compiled on Linux (and on other unixes I think).
However, windres isn't endian safe so it's useless on big endian
machines: maybe they never thought about the possibility of
crosscompilation from, say, linux powerpc to win32.
You can of course embed already made .res files, since the 2.3.1 fpcres
is endian safe. And it can also compile dfm/lfm/xfm files.

Regarding the fact that most C/C++ compilers have resource compilers...
well in general OS vendors provide resource compilers if their system
have this concept (rc.exe from microsoft, ReZ from Apple). Moreover some
compiler vendor provide their own (brcc32 from borland, wrc from watcom,
gorc), but they are not "cross platform", even if wrc is able to compile
win32, win16 and os2 resource files for those systems.

Giulio
Graeme Geldenhuys
2008-07-10 08:04:59 UTC
Permalink
vendor provide their own (brcc32 from borland, wrc from watcom, gorc), but
they are not "cross platform", even if wrc is able to compile win32, win16
and os2 resource files for those systems.
You stole my example! :-) I was just about to mention Watcom's
resource compiler. If it works for Win32, Win16 and OS/2, how can it
not be cross-platform? Or do you mean not cross-platform, because a
.res file compiled under OS/2 cannot be used as-is under Win32? If
the latter, would that really be an issue for FPC with a slogan like
"write once, compile everywhere". As long as the application is
compiled on the platform it needs to run on, the resource will be
correct. This excludes cross-compiling, no idea how that works.


Regards,
- Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
Giulio Bernardi
2008-07-10 09:13:48 UTC
Permalink
Post by Graeme Geldenhuys
vendor provide their own (brcc32 from borland, wrc from watcom, gorc), but
they are not "cross platform", even if wrc is able to compile win32, win16
and os2 resource files for those systems.
You stole my example! :-) I was just about to mention Watcom's
resource compiler. If it works for Win32, Win16 and OS/2, how can it
not be cross-platform? Or do you mean not cross-platform, because a
.res file compiled under OS/2 cannot be used as-is under Win32?
Exactly. E.g. OS/2's .res format is like the win16 one but without
support for string IDs (that is, you can't have a os/2 resource named
'MYFORM'). Moreover they have little syntax differences here and there.
For what regards wrc, it's simple: you tell wrc you want to compile a
win32 rc file, and it will output a win32 .res file. If you tell it to
use win16 format, .rc file must use that syntax and it will be compiled
as a win16 resource.
So you can't use wrc to compile a win32 rc file to a os2 res file: it's
like to have three separate resource compilers in one.
Post by Graeme Geldenhuys
If
the latter, would that really be an issue for FPC with a slogan like
"write once, compile everywhere". As long as the application is
compiled on the platform it needs to run on, the resource will be
correct. This excludes cross-compiling, no idea how that works.
The idea is that we support win32 resources everywhere, since the {$R}
stuff comes from delphi, where it's used for win32 resources.
At the moment, winlike resources aren't supported on os/2 or classic mac
os because one might want to use their platform-specific resources. One
idea I have is to add something like {$resmode native/win32} (example
case: lazarus starts using resources, someone decides to port lazarus to
os/2, we have a problem. With the switch a program could contain both
win32 resources used by lazarus and os2 resources like the program icon
and so on).

Giulio
Paul Ishenin
2008-07-10 03:37:13 UTC
Permalink
Post by Michael Van Canneyt
Post by Craig Peterson
Does any version of FPC support the {$R file} syntax for resources on
non-Windows targets? I'd prefer that to Lazarus's LResources unit. I have
the impression that some work on it was done as part of Simon Kissel's
CrossFPC project, but I haven't been able to verify that. Was work done and
never completed? Is it a TODO that just doesn't have anyone to work on it?
All targets in 2.3.1 now support {$R file} syntax
And lazarus with fpc 2.3.1 can load forms from native resources. If you
look at LResources.pas you will see:
{$IFDEF FPC_HAS_WINLIKERESOURCES}
{$DEFINE UseRES}
{$ENDIF}

There you can also look how UseRES is used.

Best regards,
Paul Ishenin.
Graeme Geldenhuys
2008-07-09 21:02:14 UTC
Permalink
Post by Craig Peterson
Thanks,
Craig Peterson
Scooter Software
Is this Scooter Software that brought the awesome Beyond Compare 2 to
Windows users? If so, I sure hope the query is because work on BC
2.xx or 3.x involves other platforms like Linux. ;-)

If not, it's ok, BC2 works very nice via Linux + WINE.

Regards,
- Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
Craig Peterson
2008-07-09 21:11:40 UTC
Permalink
Post by Graeme Geldenhuys
Is this Scooter Software that brought the awesome Beyond Compare 2 to
Windows users? If so, I sure hope the query is because work on BC
2.xx or 3.x involves other platforms like Linux. ;-)
Yes it is, and you must not be on the beta list. ;-) V3 is in public
beta and the Linux port is already available. We're currently using
Kylix, but we're looking into swapping out the compiler for FPC first,
with a transition from CLX to LCL sometime later.

http://www.scootersoftware.com/beta3/

Regards,
Craig Peterson
Scooter Software
Graeme Geldenhuys
2008-07-09 21:23:08 UTC
Permalink
Yes it is, and you must not be on the beta list. ;-) V3 is in public beta
and the Linux port is already available. We're currently using Kylix, but
we're looking into swapping out the compiler for FPC first, with a
transition from CLX to LCL sometime later.
My day is just getting better, Thanks Craig! :-) I'll try and
download the beta now. I'm a Linux junkie, but there are 3 Windows
products I can't do without. Beyond Compare 2, Total Commander and
PINS. Hopefully soon, that will be down to only 2 Windows products.
;-)

Keep up the good work!

Regards,
- Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
Joost van der Sluis
2008-07-13 19:56:26 UTC
Permalink
Op woensdag 09-07-2008 om 23:23 uur [tijdzone +0200], schreef Graeme
Post by Graeme Geldenhuys
My day is just getting better, Thanks Craig! :-) I'll try and
download the beta now. I'm a Linux junkie, but there are 3 Windows
products I can't do without. Beyond Compare 2, Total Commander and
PINS. Hopefully soon, that will be down to only 2 Windows products.
;-)
Total Commander?!? You mean Tux Commander (tuxcmd.sourceforge.net),
latest version also written in fpc.

Joost
German Gentile
2008-07-13 21:07:11 UTC
Permalink
Post by Joost van der Sluis
Op woensdag 09-07-2008 om 23:23 uur [tijdzone +0200], schreef Graeme
Post by Graeme Geldenhuys
My day is just getting better, Thanks Craig! :-) I'll try and
download the beta now. I'm a Linux junkie, but there are 3 Windows
products I can't do without. Beyond Compare 2, Total Commander and
PINS. Hopefully soon, that will be down to only 2 Windows products.
;-)
Beyond compare already have a linux version (BC 3) and work like a sharm.


HTH

Donald Shimoda

http://donaldshimoda.blogspot.com
Graeme Geldenhuys
2008-07-13 21:11:37 UTC
Permalink
Post by Joost van der Sluis
Total Commander?!? You mean Tux Commander (tuxcmd.sourceforge.net),
latest version also written in fpc.
Last time I tried Tux Commander, it didn't come close to Total
Commander. Maybe I give it another try as it's been a few months.


Regards,
- Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
German Gentile
2008-07-13 21:47:15 UTC
Permalink
Post by Graeme Geldenhuys
Last time I tried Tux Commander, it didn't come close to Total
Commander. Maybe I give it another try as it's been a few months.
_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
Big OT, your site is not working. I wanna try fpgui on lazarus.

Besty regards.

Donald Shimoda

http://donaldshimoda.blogspot.com/
Graeme Geldenhuys
2008-07-14 07:02:05 UTC
Permalink
On Sun, Jul 13, 2008 at 11:47 PM, German Gentile
Post by German Gentile
Post by Graeme Geldenhuys
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
Big OT, your site is not working. I wanna try fpgui on lazarus.
They were working on our backup generator over the weekend, so we had
to power everything down. All is back to normal again. The SubVersion
repository is on SourceForge, so you could still have gotten a copy.
Sorry for any inconvenience.


Regards,
- Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
http://www.sourceforge.net/projects/fpgui/
Luiz Americo Pereira Camara
2008-07-15 00:23:50 UTC
Permalink
Post by Graeme Geldenhuys
On Sun, Jul 13, 2008 at 11:47 PM, German Gentile
Post by German Gentile
Post by Graeme Geldenhuys
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
Big OT, your site is not working. I wanna try fpgui on lazarus.
They were working on our backup generator over the weekend, so we had
to power everything down. All is back to normal again. The SubVersion
repository is on SourceForge, so you could still have gotten a copy.
Sorry for any inconvenience.
I still can not access the website or the news server

Luiz
Paul Nicholls
2008-07-15 02:08:29 UTC
Permalink
----- Original Message -----
From: "Luiz Americo Pereira Camara" <***@bol.com.br>
To: "FPC-Pascal users discussions" <fpc-***@lists.freepascal.org>
Sent: Tuesday, July 15, 2008 10:23 AM
Subject: Re: [fpc-pascal] {$R file} support on non-Windows targets
Post by Luiz Americo Pereira Camara
Post by Graeme Geldenhuys
On Sun, Jul 13, 2008 at 11:47 PM, German Gentile
Post by German Gentile
Post by Graeme Geldenhuys
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
Big OT, your site is not working. I wanna try fpgui on lazarus.
They were working on our backup generator over the weekend, so we had
to power everything down. All is back to normal again. The SubVersion
repository is on SourceForge, so you could still have gotten a copy.
Sorry for any inconvenience.
I still can not access the website or the news server
Luiz
Hi Graeme, for your info, I can't access the page either (I'm in Australia,
if this helps)
cheers,
Paul
Graeme Geldenhuys
2008-07-15 07:44:39 UTC
Permalink
On Tue, Jul 15, 2008 at 2:23 AM, Luiz Americo Pereira Camara >
Post by Luiz Americo Pereira Camara
I still can not access the website or the news server
Sorry Luiz and Paul for the inconvenience...

Our new building is plagued with issues, plus the electritian we have
really sucks!!! He can't seem to get things done in one go, so he
seems to work in the evenings when we close (17:00), and does little
bits at a time. :-( And according to our time zone differences
(looking at your emails), that's your guys day time or something. :-(

Hopefully our electricity issues will be resolved by the end of the
week. But as I mentioned before, fpGUI code is available on
SourceForge, so is not affected by our office outages.

To get the latest code:
svn co https://fpgui.svn.sourceforge.net/svnroot/fpgui/trunk fpgui

For urgent email support, you can email me directly:
graemeg dot lists at gmail dot com

or try your luck with the newsgroup sever (lets hope by the end of the
week, all issues are resolved).


Regards,
- Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
Paul Nicholls
2008-07-15 23:05:41 UTC
Permalink
----- Original Message -----
From: "Graeme Geldenhuys" <***@gmail.com>
To: "FPC-Pascal users discussions" <fpc-***@lists.freepascal.org>
Sent: Tuesday, July 15, 2008 5:44 PM
Subject: Re: [fpc-pascal] {$R file} support on non-Windows targets
Post by Graeme Geldenhuys
On Tue, Jul 15, 2008 at 2:23 AM, Luiz Americo Pereira Camara >
Post by Luiz Americo Pereira Camara
I still can not access the website or the news server
Sorry Luiz and Paul for the inconvenience...
Our new building is plagued with issues, plus the electritian we have
really sucks!!! He can't seem to get things done in one go, so he
seems to work in the evenings when we close (17:00), and does little
bits at a time. :-( And according to our time zone differences
(looking at your emails), that's your guys day time or something. :-(
Hopefully our electricity issues will be resolved by the end of the
week. But as I mentioned before, fpGUI code is available on
SourceForge, so is not affected by our office outages.
That's ok Graeme, I was just letting you know about your site not working
incase it helped :-)
cheers,
Paul
Florian Klaempfl
2008-07-17 12:18:57 UTC
Permalink
Post by Graeme Geldenhuys
On Tue, Jul 15, 2008 at 2:23 AM, Luiz Americo Pereira Camara >
Post by Luiz Americo Pereira Camara
I still can not access the website or the news server
Sorry Luiz and Paul for the inconvenience...
Our new building is plagued with issues, plus the electritian we have
really sucks!!! He can't seem to get things done in one go, so he
seems to work in the evenings when we close (17:00), and does little
bits at a time. :-( And according to our time zone differences
(looking at your emails), that's your guys day time or something. :-(
Hopefully our electricity issues will be resolved by the end of the
week. But as I mentioned before, fpGUI code is available on
SourceForge, so is not affected by our office outages.
svn co https://fpgui.svn.sourceforge.net/svnroot/fpgui/trunk fpgui
Just in case, it is mirrored at http://svn2.freepascal.org/svn/fpgui
Graeme Geldenhuys
2008-07-17 12:28:43 UTC
Permalink
On Thu, Jul 17, 2008 at 2:18 PM, Florian Klaempfl
Post by Florian Klaempfl
Just in case, it is mirrored at http://svn2.freepascal.org/svn/fpgui
Thanks Florian! :)

As for the website, I think I must mirror it on SourceForge as well.


Regards,
- Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/

Valdas Jankūnas
2008-07-14 00:10:49 UTC
Permalink
Post by Graeme Geldenhuys
Post by Joost van der Sluis
Total Commander?!? You mean Tux Commander (tuxcmd.sourceforge.net),
latest version also written in fpc.
Last time I tried Tux Commander, it didn't come close to Total
Commander. Maybe I give it another try as it's been a few months.
How about Krusader (http://krusader.org/):

"...is an advanced twin panel (commander style) file manager for KDE and
other desktops in the *nix world, similar to Midnight or Total Commander..."
--
Valdas Jankūnas
Graeme Geldenhuys
2008-07-14 07:31:23 UTC
Permalink
I haven't tried that in years.

I found a project called Double Commander (doublecmd) on SourceForge.
It still has many visual issues (it looks quite ugly under GTK1), but
it seems to have potential - like it has a couple of nice features
like support for Total Commander plugins, very customizable etc...
I'll definitely keep my eye on this project.

By the way, it's a Lazarus based project as well! :-)


Regards,
- Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fp
Continue reading on narkive:
Loading...