Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2006-11

global_dos_alloc

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Peter Beisel

target go32v2
compiler fpc1.0.6

This  sequence succeeds
  begin
  ...
  exec( 'aTSR.EXE', '');
  // execute an external programm aTSR;
  // aTSR.EXE will hook an interrupt, terminate and stay resident
  ...
  rm := global_dos_alloc( aSize);
  rmSelector := word( rm);
  rmSegment:= word( rm shr 16);
  ...
  // deal with the allocated dos memory
  // aTSR does it's work
  ...
  // clean up
  end.
But this sequence fails:
  begin
  ...
  rm := global_dos_alloc( aSize);
  rmSelector := word( rm);
  rmSegment:= word( rm shr 16);
  ...
  exec( 'aTSR.EXE', '');  <<<<<<<< now the system hangs!!!!

Is there a memory conflict?
Who can explain it?

regards Peter

Reply by email

Tomas Hajny
to Peter Beisel
Peter Beisel wrote 31 lines
target go32v2 compiler fpc1.0.6 This sequence succeeds begin ... exec( 'aTSR.EXE', ''); // execute an external programm aTSR; // aTSR.EXE will hook an interrupt, terminate and stay resident ... rm := global_dos_alloc( aSize); rmSelector := word( rm); rmSegment:= word( rm shr 16); ... // deal with the allocated dos memory // aTSR does it's work ... // clean up end. But this sequence fails: begin ... rm := global_dos_alloc( aSize); rmSelector := word( rm); rmSegment:= word( rm shr 16); ... exec( 'aTSR.EXE', ''); <<<<<<<< now the system hangs!!!! Is there a memory conflict? Who can explain it?

First of all, check the used FPC version. If it's really 1.0.6 (i.e. this is what "ppc386 -l" gives), upgrade at least to 1.10 or preferably to 2.0.4 and try with those versions (2.0.4 has many bugs fixed and includes quite a few new features, but debugging within our text-mode IDE is broken for GO32v2 target).

Second, it's rather difficult to guess what might be happening in your code if you only reveal fragment of your Pascal program (note the "...") and we have no idea whatsoever what "aTSR.EXE" is doing (which interrupt is hooked if any, what the handler does, etc.). I'd suggest to check (with the newer FPC version) at which point it hangs. What happens if you replace your TSR with a non-TSR program - does the program execute correctly in that case (and the processing of the main program continues as usually afterwards)? Does it happen with all TSRs, or just this particular one? Etc...

Tomas

Reply by email