[fpc-pascal] Get all caller adresses of a procedure/function
Rainer Stratmann
RainerStratmann at t-online.de
Mon Aug 6 21:48:16 CEST 2012
Am Monday 06 August 2012 21:26:24 schrieb Jonas Maebe:
> It doesn't work like that. Regular calls use relative offsets on most (if
> not all) architectures we support. And in some cases we generate
> position-independent code, so then you'll have look at GOT entries to
> figure out the address. Then there are of course calls via procedure
> variables. And there's probably a ton more special cases I'm not thinking
> of right now.
Would it then be possible to implement a counter (const) which is increased at
compile time?
p1( increasedcounteratcompiletime , 'Textsnippet' ) ?
I guess it is not possible.
> >> Out of curiosity: why don't you use resourcestrings?
> >
> > It seems that is has not the flexibility and simplicity (in its entirety)
> > that I want.
>
> I would not call your method "simple"
It may is in the beginning more difficult to implement, but if it runs once I
would say this can not get much more simpler.
You only have to put p1( ) around your text snippet. That is it!
The function returns the right language.
> and would also strongly recommend to
> use resourcestrings instead. Their purpose is exactly to make it easy to
> translate the strings in a program.
That means more work to give every text snippet explicitly a name which is not
necessary with my solution. And that means also less flexibility.
The resourcestring solution does not record the date and time when a text was
changed and so on...
More information about the fpc-pascal
mailing list