[fpc-pascal]method pointers, design patterns, OP idioms etc.
memsom at interalpha.co.uk
memsom at interalpha.co.uk
Wed Nov 27 11:31:17 CET 2002
> I've a few questions:
>
> 1. Is method pointers supported ? If so can anyone provide me with some
> examples of usage.
Yes.
type
MyMethodPointer = procedure(Sender: TObject) of object;
MyclassWithMethodPointer = class
private
FMethodPointer: MyMethodPointer;
public
property MethodPointer: MyMethodPointer
read FMethodPointer write FMethodPointer;
end;
> 2. web pointers to idioms, design patterns etc. (I'm googling ....) In
> particular I'm looking for the observer pattern implementation without using
> interfaces.
This one is more tricky. Can't help you there.
> 3. I wrote a memory manager interface to the Boehm GC library. It compiled
> fine but crashed during the 'mark' phase of the collection. I think I can fix
> the problem by explicitly adding the root pointers for the collector for
> which I need to find the absolute addresses of the data and bss segments.
> Anybody knows how to get this ? (the binutils generate labels __data_start and
> __bss_start for C programs. But code generated by FPC only has __bss_start.)
Without seeing your code it is impossible to comment with any authority. It
sounds like you're making things overly compilcated though. If it works in C
without this information then you probably don't need it. Otherwise, you could
try writing a small routine to return the correct information to Pascal and add
it to the library.
Hope that helps,
Matt
---------------------------------------------
This message was sent using Mistral WebMail.
http://www.mistral.co.uk/
More information about the fpc-pascal
mailing list