[fpc-pascal] global_dos_alloc

Tomas Hajny XHajT03 at mbox.vol.cz
Fri Nov 10 18:07:50 CET 2006


Peter Beisel wrote:

> 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




More information about the fpc-pascal mailing list