I am not sure if I have hit work in progress code here....

my arm-embedded app crashes during initialization, the reason is that now exceptions are part of the rtl but there is no properly initialized heapmanager:

Procedure InitExceptions;
{
  Must install uncaught exception handler (ExceptProc)
  and install exceptions for system exceptions or signals.
  (e.g: SIGSEGV -> ESegFault or so.)
}
begin
  ExceptionClass := Exception;
  ExceptProc:=@CatchUnhandledException;
  // Create objects that may have problems when there is no memory.
  //CRASH BOOM BANG in the following line
  OutOfMemory:=EOutOfMemory.Create(SOutOfMemory);


Creating the object fails because the MemoryManager is not properly initialized yet.

When I put heapmgr unit before sysutils im my program (this should not be necesary, right???) I can debug a little deeper in object initialization but still the root cause exists that there has never been a call to RegisterHeapBlock so objects cannot be initiated because there's no memory block defined that heapmgr can draw memory from.

I can hack the RegisterHeapBlock call into the initialization code of the unit heapmgr but this is more a hack than a proper solution --> seems a bad idea to me.

How can this be properly solved?

Michael

_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to