[fpc-pascal] {$R file} support on non-Windows targets

Giulio Bernardi ugilio at gmail.com
Thu Jul 10 09:13:31 CEST 2008


Graeme Geldenhuys ha scritto:
> On Wed, Jul 9, 2008 at 8:17 PM, Giulio Bernardi <ugilio at gmail.com> wrote:
>>> 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



More information about the fpc-pascal mailing list