Sign in Join

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

Mailing lists / fpc-pascal / 2013-05

Strange error message

6 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

Darius Blaszyk

I'm working on a glut app but I keep on getting the message: Error: Can't assign local procedure/function to procedure variable

The error is at this line: glutDisplayFunc(@redrawfunc);
And the callback (which is declared in the same .inc file) is declared
as: procedure redrawfunc; cdecl;

I must be overlooking something obvious but I just don't see what. Any ideas?

Regards, Darius

Sven Barth
to Darius Blaszyk
Darius Blaszyk wrote 12 lines
I'm working on a glut app but I keep on getting the message: Error: Can't assign local procedure/function to procedure variable The error is at this line: glutDisplayFunc(@redrawfunc); And the callback (which is declared in the same .inc file) is declared as: procedure redrawfunc; cdecl; I must be overlooking something obvious but I just don't see what. Any ideas?

Is the "redrawfunc" a nested function/procedure?
Is the include file maybe included in such a way that the compiler treats its code as a nested function/procedure?

Regards,
Sven

Darius Blaszyk
to Sven Barth
Show quoted text 7 lines
Am 08.05.2013 11:20, schrieb Darius Blaszyk: > I'm working on a glut app but I keep on getting the message: Error: Can't assign local procedure/function to procedure variable The error is at this line: glutDisplayFunc(@redrawfunc); And the callback (which is declared in the same .inc file) is declared as: procedure redrawfunc; cdecl; I must be overlooking something obvious but I just don't see what. Any ideas? Is the "redrawfunc" a nested function/procedure? Is the include file maybe included in such a way that the compiler treats its code as a nested function/procedure?

No it's not nested. I have a .pas file with an interface section, next a couple of .inc files fill in the implementation section. Maybe the compiler is confused from that?

Darius

Sven Barth
to Darius Blaszyk
Darius Blaszyk wrote 15 lines
> Am 08.05.2013 11:20, schrieb Darius Blaszyk: >> I'm working on a glut app but I keep on getting the message: Error: >> Can't assign local procedure/function to procedure variable The >> error is at this line: glutDisplayFunc(@redrawfunc); And the >> callback (which is declared in the same .inc file) is declared as: >> procedure redrawfunc; cdecl; I must be overlooking something obvious >> but I just don't see what. Any ideas? > Is the "redrawfunc" a nested function/procedure? > Is the include file maybe included in such a way that the compiler > treats its code as a nested function/procedure? No it's not nested. I have a .pas file with an interface section, next a couple of .inc files fill in the implementation section. Maybe the compiler is confused from that?

Normally this should not be the case (except there is a bug). Maybe you forgot a "end;" or "begin" somewhere and now the compiler treats it as a nested procedure. Try to minimize your program as good as possible so that you should find the spot which triggers this.

Regards,
Sven

Darius Blaszyk
to Sven Barth
Show quoted text 8 lines
Am 08.05.2013 11:40, schrieb Darius Blaszyk: Am 08.05.2013 11:20, schrieb Darius Blaszyk: I'm working on a glut app but I keep on getting the message: Error: Can't assign local procedure/function to procedure variable The error is at this line: glutDisplayFunc(@redrawfunc); And the callback (which is declared in the same .inc file) is declared as: procedure redrawfunc; cdecl; I must be overlooking something obvious but I just don't see what. Any ideas? Is the "redrawfunc" a nested function/procedure? Is the include file maybe included in such a way that the compiler treats its code as a nested function/procedure?

No it's not nested. I have a .pas file with an interface section, next a couple of .inc files fill in the implementation section. Maybe the compiler is confused from that? Normally this should not be the case (except there is a bug). Maybe you forgot a "end;" or "begin" somewhere and now the compiler treats it as a nested procedure. Try to minimize your program as good as possible so that you should find the spot which triggers this.

Yup! If found a wrong begin/end. Everything works now...

Thanks!

Sven Barth
to Darius Blaszyk
Darius Blaszyk wrote 29 lines
> Am 08.05.2013 11:40, schrieb Darius Blaszyk: >> >> Am 08.05.2013 11:20, schrieb Darius Blaszyk: >> >> I'm working on a glut app but I keep on getting the message: >> Error: Can't assign local procedure/function to procedure >> variable The error is at this line: >> glutDisplayFunc(@redrawfunc); And the callback (which is >> declared in the same .inc file) is declared as: procedure >> redrawfunc; cdecl; I must be overlooking something obvious >> but I just don't see what. Any ideas? >> >> Is the "redrawfunc" a nested function/procedure? >> Is the include file maybe included in such a way that the compiler >> treats its code as a nested function/procedure? >> >> No it's not nested. I have a .pas file with an interface section, >> next a couple of .inc files fill in the implementation section. >> Maybe the compiler is confused from that? >> > Normally this should not be the case (except there is a bug). Maybe > you forgot a "end;" or "begin" somewhere and now the compiler treats > it as a nested procedure. Try to minimize your program as good as > possible so that you should find the spot which triggers this. Yup! If found a wrong begin/end. Everything works now... Thanks!

You're welcome. :)

Regards,
Sven