[fpc-pascal] resourcestring and const arrays

Craig Peterson craig at scootersoftware.com
Sat Jun 25 01:56:58 CEST 2011


On 6/24/2011 4:14 PM, Marco van de Voort wrote:
> No, this is a problem of gettext.

It's a problem with FPC's resourcestring implementation, rather than
something specific to gettext.  I could use SetResourceStrings directly
(objpas.pp) and it will have the same issue.

> For this to work you really need resource types that work based on
> replacing memory areas, or use _()

What do you mean by replacing memory areas?  Runtime patching?  Does 
something exist that supports that?  On Windows we're using resource 
DLLs directly, without going through gettext, so I really don't want to 
switch to _().  I don't mind low-level hacking though. ;)

It looks like Delphi writes a table of these kinds of resource string 
uses and fixes them up during program initialization.  If FreePascal had 
a similar table it could do the same thing as part of SetResourceStrings.

Assuming Krzysztof is correct that the compiler flattens the references, 
I'm guessing replacing the FPC_RESOURCESTRINGTABLES section won't help 
either.  If it would, I'd be happy to look into that approach too.

If fixing this is correctly is a reasonable possibility, I'm happy to 
look into it myself, but I would like to hear how attainable it's likely 
to be first, since I've never worked on a compiler before.

-- 
Craig Peterson
Scooter Software




More information about the fpc-pascal mailing list