Sign in Join

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

Mailing lists / fpc-pascal / 2016-10

Error: Identifier not found "Heap Error"

8 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

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

Luiz Gonzaga de Oliveira Neto

Hello all,

As mentioned in a previous e-mail, I'm having my first contact with Pascal during my Masters research, trying to compile a code provided by a professor.

The first mistakes I had regarded the *memavail *and *maxavail* functions, which I've read are not supported anymore. I believe I have overcome these issues, but I still get the following error:

OPTIQAP.PAS(18,21) Error: Identifier not found "HeapError"
OPTIQAP.PAS(19,6) Error: Identifier not found "HeapError"

As I mentioned in the previous e-mail, this code was provided by me by a reputed professor, so I have reasons to believe it's correct. My question is: do you know if this error could be happening due to some version incompatibility or some missing flag during compilation? Or is it probably caused by some mistake in the code? Or would you need more information to answer this?

Sorry if the question is silly, as I've mentioned, this is my first contact with Pascal and FPC.

Thanks in advance for any help,

------ Luiz G. de Oliveira Neto ------ ------------ Unicamp - EC09 -----------
Michael Van Canneyt
to Luiz Gonzaga de Oliveira Neto
Luiz Gonzaga de Oliveira Neto wrote 22 lines
Hello all, As mentioned in a previous e-mail, I'm having my first contact with Pascal during my Masters research, trying to compile a code provided by a professor. The first mistakes I had regarded the *memavail *and *maxavail* functions, which I've read are not supported anymore. I believe I have overcome these issues, but I still get the following error: OPTIQAP.PAS(18,21) Error: Identifier not found "HeapError" OPTIQAP.PAS(19,6) Error: Identifier not found "HeapError" As I mentioned in the previous e-mail, this code was provided by me by a reputed professor, so I have reasons to believe it's correct. My question is: do you know if this error could be happening due to some version incompatibility or some missing flag during compilation? Or is it probably caused by some mistake in the code? Or would you need more information to answer this? Sorry if the question is silly, as I've mentioned, this is my first contact with Pascal and FPC.

This is possibly code intended for Turbo Pascal.
The HeapError identifier does not exist in Free Pascal. At least, I have not found any.

In some old Free Vision code, I found a reference to HeapError which seems to be a callback function variable, but it is not active for Free Pascal. I suggest you simply remove any lines that contain HeapError.

Michael.

Mark Morgan Lloyd
to Michael Van Canneyt
Michael Van Canneyt wrote 11 lines
> issues, but I still get the following error: > > OPTIQAP.PAS(18,21) Error: Identifier not found "HeapError" > OPTIQAP.PAS(19,6) Error: Identifier not found "HeapError" This is possibly code intended for Turbo Pascal. The HeapError identifier does not exist in Free Pascal. At least, I have not found any. In some old Free Vision code, I found a reference to HeapError which seems to be a callback function variable, but it is not active for Free Pascal. I suggest you simply remove any lines that contain HeapError.

I've got a 5.0 manual to hand [blows dust off, coughs]. The function takes size (bytes?) as parameter, returns 0 by default indicating that a runtime error should be raised, but may alternatively return 1 (New or GetMem should return Nil) or 2 (New or GetMem should retry).

Presumably it's in there to allow normal memory management to be augmented with application-specific garbage collection, I've seen this in the Pascal source for a Prolog system (not the Spivey one).

Perhaps Michael et al. would confirm this, but I'd expect FPC to use the OS's memory management including virtual memory, so within limits I'd not expect to see memory exhaustion in finite time. The residual use of this function is to return Nil rather than forcing a run-time error if there is an allocation problem.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]
Luiz Gonzaga de Oliveira Neto
to Bart

Hi all,

Thanks for the help.

Would be it be better to try to compile this with the Turbo Pascal compiler then? Or do you think it would be easier to try to remove the lines with these codes and continue with FPC? My fear is that in some of these modifications I change what the code was supposed to do.

Best regards,

PM Bart wrote 11 lines
On 10/16/16, Mark Morgan Lloyd wrote: > I've got a 5.0 manual to hand [blows dust off, coughs]. See: http://putka.upm.si/langref/turboPascal/0683.html Bart _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
------ Luiz G. de Oliveira Neto ------ ------------ Unicamp - EC09 -----------
Michael Van Canneyt
to Luiz Gonzaga de Oliveira Neto
Luiz Gonzaga de Oliveira Neto wrote 8 lines
Hi all, Thanks for the help. Would be it be better to try to compile this with the Turbo Pascal compiler then? Or do you think it would be easier to try to remove the lines with these codes and continue with FPC? My fear is that in some of these modifications I change what the code was supposed to do.

Normally, you can just remove the lines that contain HeapError.

Michael.

Jonas Maebe
to Luiz Gonzaga de Oliveira Neto: Thanks for the help. Would be it be better to try to compile this with the Turbo Pascal…
Luiz Gonzaga de Oliveira Neto wrote
Would be it be better to try to compile this with the Turbo Pascal compiler then? Or do you think it would be easier to try to remove the lines with these codes and continue with FPC? My fear is that in some of these modifications I change what the code was supposed to do.

As the link that Bart posted explains
(http://putka.upm.si/langref/turboPascal/0683.html ), HeapError is a pointer to a function that would be called when you're out of memory. That happened quite regularly if all you had was 640KB, but it is extremely unlikely to happen if you are running that same program on the same inputs on a 32 or even 64 bit platform.

If that would happen anyway, then by default FPC will terminate your program with a Run-time error 204. You can then still look at what the original program did if it ran out of memory and try to do the same in a more preventative way, if it did not simply use that HeapError function pointer to print a (more user-friendly) error message and terminate as well.

Jonas

Luiz Gonzaga de Oliveira Neto
to Jonas Maebe

Thank you all for the help!

AM Jonas Maebe wrote 26 lines
Luiz Gonzaga de Oliveira Neto wrote: > Would be it be better to try to compile this with the Turbo Pascal > compiler then? Or do you think it would be easier to try to remove the > lines with these codes and continue with FPC? My fear is that in some of > these modifications I change what the code was supposed to do. As the link that Bart posted explains (http://putka.upm.si/langref/turboPascal/0683.html ), HeapError is a pointer to a function that would be called when you're out of memory. That happened quite regularly if all you had was 640KB, but it is extremely unlikely to happen if you are running that same program on the same inputs on a 32 or even 64 bit platform. If that would happen anyway, then by default FPC will terminate your program with a Run-time error 204. You can then still look at what the original program did if it ran out of memory and try to do the same in a more preventative way, if it did not simply use that HeapError function pointer to print a (more user-friendly) error message and terminate as well. Jonas _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
------ Luiz G. de Oliveira Neto ------ ------------ Unicamp - EC09 -----------