Recent

Author Topic: A strange error when trying to get the 'handle' from a far Procedure  (Read 440 times)

FlierMate

  • Jr. Member
  • **
  • Posts: 60
This is the error. I've never seen this kind of error in Pascal although I self-claimed as somewhat experienced programmer.

Quote
Error: Incompatible types: got "untyped" expected "<procedure variable type of procedure;Register>"

The code:
Code: Pascal  [Select][+][-]
  1. procedure ShowUsage: far
  2. begin
  3. .....
  4. .....
  5. end;
  6.  
  7. constructor TMyApp.Init;
  8. begin
  9.     PShowUsage:=ShowUsage;
  10.     .....
  11.      ....
  12. end;

There is no declaractino of PShowUsage in the entire source file.

Can someone know how to fix this error?
FPC 3.2.0 on i386-Win32.

PascalDragon

  • Hero Member
  • *****
  • Posts: 2748
  • Compiler Developer
Re: A strange error when trying to get the 'handle' from a far Procedure
« Reply #1 on: January 27, 2021, 01:25:55 pm »
There is no declaractino of PShowUsage in the entire source file.

Is the source available publicly?

FlierMate

  • Jr. Member
  • **
  • Posts: 60
Re: A strange error when trying to get the 'handle' from a far Procedure
« Reply #2 on: January 27, 2021, 01:29:28 pm »
There is no declaractino of PShowUsage in the entire source file.

Is the source available publicly?

Yes, Mark MLI uploaded it to GitHub. Please find the original post here: https://forum.lazarus.freepascal.org/index.php/topic,52452.msg386512.html#msg386512

There are a few errors need to fix before you would come to the abovesaid error.
FPC 3.2.0 on i386-Win32.

dseligo

  • Jr. Member
  • **
  • Posts: 78
Re: A strange error when trying to get the 'handle' from a far Procedure
« Reply #3 on: January 27, 2021, 01:34:58 pm »
Maybe PShowUsage is pointer to ShowUsage. Try this:
Code: Pascal  [Select][+][-]
  1. PShowUsage:=@ShowUsage;

or

Code: Pascal  [Select][+][-]
  1. {$MODE Delphi}

on the top.

FlierMate

  • Jr. Member
  • **
  • Posts: 60
Re: A strange error when trying to get the 'handle' from a far Procedure
« Reply #4 on: January 27, 2021, 01:39:32 pm »
Maybe PShowUsage is pointer to ShowUsage. Try this:
Code: Pascal  [Select][+][-]
  1. PShowUsage:=@ShowUsage;


It is so simple, thanks for the quick solution.
FPC 3.2.0 on i386-Win32.

lucamar

  • Hero Member
  • *****
  • Posts: 3598
Re: A strange error when trying to get the 'handle' from a far Procedure
« Reply #5 on: January 27, 2021, 01:47:54 pm »
There is no declaractino of PShowUsage in the entire source file.

It's declared in unit params (Params.pas) as:

Code: Pascal  [Select][+][-]
  1. var
  2.     PShowUsage: procedure;

Note that FPC by default uses "fpc" mode, which requires the address operator to assign procedural variables, so either change the mode to "tp" using {$mode tp} or change that line (and any other similar to it) to:
Code: Pascal  [Select][+][-]
  1. PShowUsage := @ShowUsage;

HTH!
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.10/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

FlierMate

  • Jr. Member
  • **
  • Posts: 60
Re: A strange error when trying to get the 'handle' from a far Procedure
« Reply #6 on: January 27, 2021, 01:52:14 pm »
There is no declaractino of PShowUsage in the entire source file.

It's declared in unit params (Params.pas) as:

Code: Pascal  [Select][+][-]
  1. var
  2.     PShowUsage: procedure;

Note that FPC by default uses "fpc" mode, which requires the address operator to assign procedural variables, so either change the mode to "tp" using {$mode tp} or change that line (and any other similar to it) to:
Code: Pascal  [Select][+][-]
  1. PShowUsage := @ShowUsage;

HTH!

Thanks for pointing this out! I overlooked the unit files.  :P

Your explanation helped.

With this error fixed, I will still having a hard time to debug the runtime error, for example Runtime 215 when you try to create a new dialog.... Hmm....
FPC 3.2.0 on i386-Win32.

FlierMate

  • Jr. Member
  • **
  • Posts: 60
Re: A strange error when trying to get the 'handle' from a far Procedure
« Reply #7 on: January 27, 2021, 02:07:02 pm »
May I know how to make this a community project? Me alone is incapable to debug it to make it usable in Win32 environment. Need more contributors....
FPC 3.2.0 on i386-Win32.

lucamar

  • Hero Member
  • *****
  • Posts: 3598
Re: A strange error when trying to get the 'handle' from a far Procedure
« Reply #8 on: January 27, 2021, 08:33:27 pm »
First of all and since Mark felt he didn't want to "polute" his but keep it intact for historical reasons, start with a new public repository (or a clone of Mark's) in SF or github or wherever.

Once that is done I would make a post in "Third party" asking for contributions but only if you can make a commitment to engage as maintainer of the port for at least some years.

Even then, don't expect to be swamped by request to be volunteer: very few people use FV nowadays and those few that do are, for the most part, maintainers of (very) old projects w/out a real need for this tool.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.10/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

FlierMate

  • Jr. Member
  • **
  • Posts: 60
Re: A strange error when trying to get the 'handle' from a far Procedure
« Reply #9 on: January 27, 2021, 09:38:01 pm »
First of all and since Mark felt he didn't want to "polute" his but keep it intact for historical reasons, start with a new public repository (or a clone of Mark's) in SF or github or wherever.

Once that is done I would make a post in "Third party" asking for contributions but only if you can make a commitment to engage as maintainer of the port for at least some years.

Even then, don't expect to be swamped by request to be volunteer: very few people use FV nowadays and those few that do are, for the most part, maintainers of (very) old projects w/out a real need for this tool.

Thank you very much for the kind intention and assistance offered.

I think need to wait after I check whether this improved version of DialEdit+ is a working copy:
https://github.com/joecare99/Public/tree/master/Projects/DialEdit.p

FPC 3.2.0 on i386-Win32.

 

TinyPortal © 2005-2018