[fpc-pascal]
Nico Aragón
na-list at espira.net
Thu May 5 16:22:14 CEST 2005
El Jueves, 5 de Mayo de 2005 05:49, Anandu R Suri escribió:
> 2. Since my Operating System will be Object Oriented, the compilation
> consists of calling a FPC_HELP_CONTRUCTOR which in turn calls the built in
> AsmGetMem function. But during the system initialization process there will
> be no memory manager. Is there a possiblity of constructing an object at a
> predetermined location like in C++?
As far as I know, FPC object model tries to be compatible with Delphi's. I say
this because I do know that what I'm going to tell you works with Delphi. But
I'm not sure that it works with FPC. Please read the docs or the source to
check it.
In Delphi TObject has some class methods that provide a hook to customize the
lifecycle of memory: NewInstance and FreeInstance. The default behaviour is
to call GetMem asking for InstaceSize bytes.
You can override NewInstace to return memory from a predetermined location.
You should also override FreeInstance accordingly to do nothing.
Another possibility is to call InitInstance (or the constructor using
assembler, for that matter) on some arbitrary buffer. Check the source for
constructor calls.
--
saludos,
Nico Aragón
More information about the fpc-pascal
mailing list