[fpc-pascal] (no subject)
Barracuda
barracuda72 at bk.ru
Fri Mar 7 20:26:00 CET 2014
Hello, guys!
Firstly, thank you for such a great project! It's very nice to use it in a study process in a school/university.
And now a question :)
I have some trouble working on one of my projects, it's code is here:
https://github.com/Barracuda72/PT
The problem is with function "SentenceSample" in "PT4LibIFace.pas"; there are two ways - my stupidness or mysterious behavior of FPC compiler.
Code:
---------------------------------------------------------
function SentenceSample(N: integer): string; stdcall;
begin
//writeln('N = ', N);
//SentenceSample := RuGetSentence(N);
inc(N);
end;
---------------------------------------------
Of course, inc(N); added just to simplify disassembling. And there is disasm:
---------------------------------------------
sentencesample proc near
push ebp
mov ebp, esp
inc [ebp+0Ch]
leave
retn 8
---------------------------------------------
As you can see, procedure has only one parameter, but FPC generates code as if there are two
parameters; and the main problem is that it trying to work with wrong variable (N is in ebp+08,
not 0C; it's obvious and proved by debugging). The result is bad =)
So, can you say, there am I wrong?
Ah, I'm using Lazarus 1.0.14 with FPC 2.6.2, Win32 build
More information about the fpc-pascal
mailing list