Re: [Lazarus] Resources without RC files

2023-05-04 Thread Ondrej Pokorny via lazarus

On 04.05.2023 11:02, Michael Van Canneyt wrote:

On Thu, 4 May 2023, Ondrej Pokorny wrote:

On 04.05.2023 08:38, Michael Van Canneyt wrote:

On Thu, 4 May 2023, Ondrej Pokorny via lazarus wrote:
How is it possible that the LFM files are included directly but 
*.SQL files are parsed as RC files?


Because the file extension is recognized ? LFM is included as 
RC_DATA, and probably everything that is not .lfm is assumed to be a 
RC format.


I believe fpcres also has this check.


Thanks for the tip. I found it - it is directly in the compiler.

In comprsrc.pas TWinLikeResourceFile.IsCompiled there is a logic that 
defines what the compiler does with the included resource file based 
on the extension or file header.


I don't like the fact that there are hard-coded constants for what 
seems to be (for a stranger) arbitrary file extensions and that it is 
not documented anywhere.


Well, developers that are using lazarus and form files know what happens.

This is undoubtedly the majority of FPC users, so I don't think this 
is an

issue.


It is still confusing - in pas2js any file can be added as a resource with:

{$R abc.xyz}

In FPC only LFM, so hence the question why and how :)

Ondrej

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Resources without RC files

2023-05-04 Thread Michael Van Canneyt via lazarus




On Thu, 4 May 2023, Ondrej Pokorny wrote:


On 04.05.2023 08:38, Michael Van Canneyt wrote:

On Thu, 4 May 2023, Ondrej Pokorny via lazarus wrote:
How is it possible that the LFM files are included directly but *.SQL 
files are parsed as RC files?


Because the file extension is recognized ? LFM is included as RC_DATA, and 
probably everything that is not .lfm is assumed to be a RC format.


I believe fpcres also has this check.


Thanks for the tip. I found it - it is directly in the compiler.

In comprsrc.pas TWinLikeResourceFile.IsCompiled there is a logic that defines 
what the compiler does with the included resource file based on the extension 
or file header.


I don't like the fact that there are hard-coded constants for what seems to 
be (for a stranger) arbitrary file extensions and that it is not documented 
anywhere.


Well, developers that are using lazarus and form files know what happens.

This is undoubtedly the majority of FPC users, so I don't think this is an
issue.

But it should definitely be documented.

Michael.
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Resources without RC files

2023-05-04 Thread Ondrej Pokorny via lazarus

On 04.05.2023 08:38, Michael Van Canneyt wrote:

On Thu, 4 May 2023, Ondrej Pokorny via lazarus wrote:
How is it possible that the LFM files are included directly but *.SQL 
files are parsed as RC files?


Because the file extension is recognized ? LFM is included as RC_DATA, 
and probably everything that is not .lfm is assumed to be a RC format.


I believe fpcres also has this check.


Thanks for the tip. I found it - it is directly in the compiler.

In comprsrc.pas TWinLikeResourceFile.IsCompiled there is a logic that 
defines what the compiler does with the included resource file based on 
the extension or file header.


I don't like the fact that there are hard-coded constants for what seems 
to be (for a stranger) arbitrary file extensions and that it is not 
documented anywhere.


I will raise the question in the FPC mailing list.

Ondrej

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


Re: [Lazarus] Resources without RC files

2023-05-04 Thread Michael Van Canneyt via lazarus




On Thu, 4 May 2023, Ondrej Pokorny via lazarus wrote:


Hello,

I see that the LCL includes LFM files as resources directly without a *.RC 
file:


{$R *.lfm}

---

But if I do this with my custom file. E.g.:

{$R *.sql}

I get an "error when compiling resources":

Compile Project, Mode: Debug, Target: Test.exe: Exit code 1, Errors: 1, 
Warnings: 1

Warning: windres: can't open file `REPLACE': No such file or directory
uTest.pas(96,0) Error: Error while compiling resources -> Compile with -vd 
for more details. Check for duplicates.


---

How is it possible that the LFM files are included directly but *.SQL files 
are parsed as RC files?


Because the file extension is recognized ? LFM is included as RC_DATA, and 
probably everything that is not .lfm is assumed to be a RC format.


I believe fpcres also has this check.

Michael.
--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus


[Lazarus] Resources without RC files

2023-05-04 Thread Ondrej Pokorny via lazarus

Hello,

I see that the LCL includes LFM files as resources directly without a 
*.RC file:


{$R *.lfm}

---

But if I do this with my custom file. E.g.:

{$R *.sql}

I get an "error when compiling resources":

Compile Project, Mode: Debug, Target: Test.exe: Exit code 1, Errors: 1, 
Warnings: 1

Warning: windres: can't open file `REPLACE': No such file or directory
uTest.pas(96,0) Error: Error while compiling resources -> Compile with 
-vd for more details. Check for duplicates.


---

How is it possible that the LFM files are included directly but *.SQL 
files are parsed as RC files?


---

I checked the Wiki and Docs, but didn't find any information about it:

https://wiki.freepascal.org/Lazarus_Resources
https://www.freepascal.org/docs-html/prog/progsu67.html#x74-730001.2.67

Thanks
Ondrej

--
___
lazarus mailing list
lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus