Hello together!
Thanks to the work of Martok (https://lists.freepascal.org/pipermail/fpc-pascal/2019-January/055476.html) the fpcres utility is now able to compile RC files into RES files.
To compile an RC file to a RES file you need to pass the -of res argument as otherwise the RC reader won't be used (it's a "catch all" TResourceReader descendant and thus not registered by default). You can specify include paths for the preprocessor using --include <path> and defines can be declared using -D sym (including defines with values using -D sym=val).
...
Would it mean that fpc could produce now *.res resource files without the need of windres in Windows and Unix OS system too?
Off topic, but let's hope we don't have to wait a long time for this to make a official release. :)
Would it mean that fpc could produce now *.res resource files without the need of windres in Windows and Unix OS system too?
Yes, though for now you need to pass the parameter -FF to the compiler so that it uses fpcres instead of windres / gorc
However to make it default we need people to test it with their projects now
Is it possible to try it with fpc 3.2.0 ?
Adding that parameter: -FF
Gives that error at compilation:
Error: (11006) Illegal parameter: -FF
windres /lazpaint-master/lazpaint/lazpaint.rc lazpaint.res
But is it possible to use fpcres as stand-alone, something like:That will produce a myresource.res.
fpcres myresource.rc
And so first produce the .res , and in code, just use:
{$R *.res}
But is it possible to use fpcres as stand-alone, something like:That will produce a myresource.res.
fpcres myresource.rc
And so first produce the .res , and in code, just use:
{$R *.res}
You can always add it as an "Execute before" command in the "Compiler Commands" options of the project but you need an fpcres able to deal with .rc files; the only thing the currently released version (2.0) is able to do is convert a .res, normally into .o to link into the executable.
And even with the newish one you need to set all those options, as you have already discovered :)
OK, I get it, this works perfectly on Linux (note the last parameters):
fred@fiens ~/l/lazpaint> fpcres /home/fred/lazpaint-master/lazpaint/lazpaint.rc -o lazpaint.res -of res
Yes, we've decided against enabling res output by default (or some auto magic) due to backwards compatibility.
fpcres shadersrc.rc -o shadersrc.res -of res
#MAIN.RC(1:43): at "emptycirclevertex": syntax error
vertexemptycircle RCDATA emptycirclevertex.ssrc
^
vertexemptycircle RCDATA emptycirclevertex.ssrc
thefontmeta RCDATA "c:\candelasvn\candelatex\pic\fonts\arial.fnt"
Yes, we've decided against enabling res output by default (or some auto magic) due to backwards compatibility.
But, what about .rc input? Is it also disabled unless an output format is set? 'Cause that would kind of defeat the purpose of the new feature ... whatever that is :)
IMHO, when one adds a new input format one should also define a default output one for it, depending on the purpose of the tool. Since fpcres has 'most always been about creating an object for linking, it's understandable that res output be available only on demand, but the problem seems to be that there is no default support for rc input either.
I tried on one of my RCs (which embed shader files as resource streams), and it gives an error.