Unsuccessfull linking but successfull finishing [Solved]

Beta Testing discussion on mikroPascal PRO for PIC.
Post Reply
Author
Message
Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Unsuccessfull linking but successfull finishing [Solved]

#1 Post by Dany » 05 May 2010 10:34

Hi, see the attched gif file. The project build seems to be successfull while the linking failed.
(v3.50 bèta.)
Image
Confirmed solved in mP v3.80. :D
Last edited by Dany on 14 May 2010 21:33, edited 3 times in total.
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Bryn
Posts: 26
Joined: 18 Apr 2009 12:38

Re: Unsuccessfull linking but successfull finishing?

#2 Post by Bryn » 06 May 2010 00:24

I have similar errors with v2.50 when I've tried to have one procedural var call another procedural var - something that's apparently not possible with this Pascal and which is a complete project show-stopper for me.
A trivial demo example:

Code: Select all

program ProcVarTest;                                    

uses
  LibInit,LibLCD4Bit;  // set up MCU I/O and use my own LCD library

type
  tProc=procedure;

var
  ProcVar1,ProcVar2: ^tProc;

procedure Proc1;
begin
  LCDWrite('this is Proc1')
end;

procedure Proc2;
begin
  LCDWrite('this is Proc2');
// uncomment "ProcVar1^" line below and attempting to recompile
// gets the completely bogus error "Recursion or cross-calling of LCDWrite"
// (also for for Proc1), followed by "Not enough RAM for call stack"
//  ProcVar1^
end;

begin
  InitProject;
  LCDWrite('Hello World');
  ProcVar1:=@Proc1;
  ProcVar2:=@Proc2;
  ProcVar1^;
  ProcVar2^
end.
(there's nothing fancy going on in either of the used units: it's all basic stuff)
This is possible in FreePascal and Delphi, and I'm surprised it's not possible here.
The error message is bogus because there's NO cross-calling and in any case, surely the only limits in play should be those applying to the use of any procedures - whether compiled as a conventional procedure and run directly through code or when a procedure's address is assigned to a procedural var.
To do otherwise makes for an uncomfortable imbalance and I'm disappointed that I seem to have been hit by a rather strange implementation limitation. The procedure address is still the procedure address even after it's been assigned to a var, right?, and I don't understand why the stack frame should (apparently) have to be handled differently depending on whether the procedure is called through a var or directly through code.


BTW (off-topic but loosely related): could the requirement for the trailing '^' at the end of a call by procedural var be dropped?
I guess it's technically correct to write the call as SomeProcVarName^ but writing just SomeProcVarName is more intuitive. IIRC an early release of Delphi had the same requirement but it was dropped in favour of the "unadorned" procedural var name.

edit:
( :oops: oops - a brainfart. I meant v3.20 of course...)
Last edited by Bryn on 06 May 2010 17:12, edited 1 time in total.
To err is human; to moo, bovine.

User avatar
slavisa.zlatanovic
mikroElektronika team
Posts: 1321
Joined: 07 Apr 2009 09:39

Re: Unsuccessfull linking but successfull finishing?

#3 Post by slavisa.zlatanovic » 06 May 2010 09:12

Hi Dany and Bryn!

Dany:
Please, send me your project. I would like to reproduce your problem and inform our developers about it.
You can send it to my email: slavisa.zlatanovic@mikroe.com

Bryn:
I'll try to reproduce your problem and get back to you later.

Best regards
Slavisa
Best regards
Slavisa

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: Unsuccessfull linking but successfull finishing?

#4 Post by Dany » 06 May 2010 12:51

slavisa.zlatanovic wrote:Please, send me your project. I would like to reproduce your problem and inform our developers about it.
Hi Slavisa, I can not send the actual project to you (it is not mine), but I will try to simulate a project where compiling succeeds and linking fails...
(I assume you can make this type of project as well).
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Bryn
Posts: 26
Joined: 18 Apr 2009 12:38

Re: Unsuccessfull linking but successfull finishing?

#5 Post by Bryn » 06 May 2010 17:18

slavisa.zlatanovic wrote:Bryn:
I'll try to reproduce your problem and get back to you later.
Many thanks, Slavisa.
I really hope this can be nailed ASAP and procedure calls end up being treated identically - irrespective of whether they're called directly or via their address in a variable.
To err is human; to moo, bovine.

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: Unsuccessfull linking but successfull finishing?

#6 Post by Dany » 06 May 2010 19:21

Dany wrote:
slavisa.zlatanovic wrote:Please, send me your project. I would like to reproduce your problem and inform our developers about it.
Hi Slavisa, I can not send the actual project to you (it is not mine), but I will try to simulate a project where compiling succeeds and linking fails...
(I assume you can make this type of project as well).
Hi Slavisa, one can force a failed linking by declaring a too large array with respect to the ram size of the PIC and try to use that array. This gives an error of the linker: "not enough Ram", but the total project succeeds as in the first post.

Extract from the logfile:
...
diagnostics: 0 134 Compiled Successfully C:\PIC Projects PRO compiler\Tests\Test Recursive Unit usage\TestRecursiveUnits.mpas
diagnostics: 0 139 All files Compiled in 120 ms
error: 5 362 Not enough RAM 'ttttt' unit3.mpas
error: 0 453 Unsuccessful linking 'TestRecursiveUnits.mpppi' Unsuccessful linking 'TestRecursiveUnits.mpppi'
diagnostics: 0 103 Finished successfully: 06 mei 2010, 20:21:03 TestRecursiveUnits.mpppi
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

User avatar
slavisa.zlatanovic
mikroElektronika team
Posts: 1321
Joined: 07 Apr 2009 09:39

Re: Unsuccessfull linking but successfull finishing?

#7 Post by slavisa.zlatanovic » 07 May 2010 11:36

Hi Bryn!

I couldn't reproduce your problem.
Please, send me your full project.
You can send it to my email: slavisa.zlatanovic@mikroe.com

Regards
Best regards
Slavisa

User avatar
slavisa.zlatanovic
mikroElektronika team
Posts: 1321
Joined: 07 Apr 2009 09:39

Re: Unsuccessfull linking but successfull finishing?

#8 Post by slavisa.zlatanovic » 07 May 2010 11:43

Hi Dany!

I've reproduced the issue you're talking about. I'll inform our developers of it.
Thanks for reporting!

Regards
Best regards
Slavisa

Bryn
Posts: 26
Joined: 18 Apr 2009 12:38

Re: Unsuccessfull linking but successfull finishing?

#9 Post by Bryn » 07 May 2010 23:18

slavisa.zlatanovic wrote:Please, send me your full project.
Ah... problem - it's for a client so not really all mine to give.
I'll strip it down to the absolute basics that still show the problem and get back to you.

Edit:
Done - a zip file is on its way to you.
Many thanks.
To err is human; to moo, bovine.

Dany
Posts: 3854
Joined: 18 Jun 2008 11:43
Location: Nieuwpoort, Belgium
Contact:

Re: Unsuccessfull linking but successfull finishing?

#10 Post by Dany » 14 May 2010 20:27

slavisa.zlatanovic wrote:Hi Dany!

I've reproduced the issue you're talking about. I'll inform our developers of it.
Thanks for reporting!

Regards
Confirmed solved in mP v3.80. :D
Kind regards, Dany.
Forget your perfect offering. There is a crack in everything, that's how the light gets in... (L. Cohen)
Remember when we were young? We shone like the sun. (David Gilmour)

Post Reply

Return to “mikroPascal PRO for PIC Beta Testing”