Sign in Join

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

Mailing lists / fpc-devel / 2001-01

Possible Compiler bug in FPC 1.04 under Win32?

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

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

murphy

Hi!

When i compile the attached source code i got some strange errors.

--snip--
Compiling devpdflib.pas
devpdflib.pas(88,27) Error: Incompatible types: got "<procedure variable type of function():SmallInt;ClearStack;Cdecl>" expected "SMALLINT" devpdflib.pas(104,27) Error: Incompatible types: got "<procedure variable type of function():SmallInt;ClearStack;Cdecl>" expected "SMALLINT" devpdflib.pas(120,14) Error: Incompatible types: got "<procedure variable type of function():^TPDF;ClearStack;Cdecl>" expected "PPDF" devpdflib.pas(138) Fatal: There were 3 errors compiling module, stopping --snip--

The source code is for first error:

type
  TPDF_get_majorversion =function:Integer cdecl;
var
  FPDF_get_majorversion :TPDF_get_majorversion;
function PDF_get_majorversion:Integer;
begin
  PDF_get_majorversion:=FPDF_get_majorversion;
end;

The function call returns an error.
Does anyone knows why?

Please help me as fast as you can...

Bye, Torsten

_,,,o¿o,,,_

Reply by email

murphy

Hi!

When i compile the attached source code i got some strange errors.

--snip--
Compiling devpdflib.pas
devpdflib.pas(88,27) Error: Incompatible types: got "<procedure variable type of function():SmallInt;ClearStack;Cdecl>" expected "SMALLINT" devpdflib.pas(104,27) Error: Incompatible types: got "<procedure variable type of function():SmallInt;ClearStack;Cdecl>" expected "SMALLINT" devpdflib.pas(120,14) Error: Incompatible types: got "<procedure variable type of function():^TPDF;ClearStack;Cdecl>" expected "PPDF" devpdflib.pas(138) Fatal: There were 3 errors compiling module, stopping --snip--

The source code is for first error:

type
  TPDF_get_majorversion =function:Integer cdecl;
var
  FPDF_get_majorversion :TPDF_get_majorversion;
function PDF_get_majorversion:Integer;
begin
  PDF_get_majorversion:=FPDF_get_majorversion;
end;

The function call returns an error.
Does anyone knows why?

Please help me as fast as you can...

Bye, Torsten

------- End of forwarded message -------
_,,,o¿o,,,_

The following section of this message contains a file attachment prepared for transmission using the Internet MIME message format. If you are using Pegasus Mail, or any another MIME-compliant system, you should be able to save it or view it from within your mailer. If you cannot, please ask your system administrator for assistance.

---- File information -----------
File: devPDFLib.pas
Date: 17 Jan 2001, 12:53
Size: 3016 bytes.
Type: Program-source

Reply by email

Peter Vreman
Show quoted text 10 lines
Hi! When i compile the attached source code i got some strange errors. --snip-- Compiling devpdflib.pas devpdflib.pas(88,27) Error: Incompatible types: got "<procedure variable type of function():SmallInt;ClearStack;Cdecl>" expected "SMALLINT" devpdflib.pas(104,27) Error: Incompatible types: got "<procedure

variable> type of function():SmallInt;ClearStack;Cdecl>" expected "SMALLINT"

devpdflib.pas(120,14) Error: Incompatible types: got "<procedure

variable> type of function():^TPDF;ClearStack;Cdecl>" expected "PPDF"

Show quoted text 13 lines
devpdflib.pas(138) Fatal: There were 3 errors compiling module, stopping --snip-- The source code is for first error: type TPDF_get_majorversion =function:Integer cdecl; var FPDF_get_majorversion :TPDF_get_majorversion; function PDF_get_majorversion:Integer; begin PDF_get_majorversion:=FPDF_get_majorversion;
Use
   PDF_get_majorversion:=FPDF_get_majorversion();
end; The function call returns an error. Does anyone knows why?

Read porting TP code to FPC code about procedure variable differences

Reply by email

murphy
to murphy: Hi! When i compile the attached source code i got some strange errors. --snip-- Compiling…

Hi!

I think i got a solution for this problem...

Show quoted text 9 lines
type TPDF_get_majorversion =function:Integer cdecl; var FPDF_get_majorversion :TPDF_get_majorversion; function PDF_get_majorversion:Integer; begin PDF_get_majorversion:=FPDF_get_majorversion; end;
type
  TPDF_get_majorversion =function:Integer cdecl;
var
  FPDF_get_majorversion :TPDF_get_majorversion;
function PDF_get_majorversion:Integer;
begin
  PDF_get_majorversion:=FPDF_get_majorversion();
end;

The parentices must be added when calling the function. After that modification the compiler compiles the source code...

Bye, Torsten

Is is a compiler-bug?

_,,,o¿o,,,_

Reply by email

Peter Vreman
Show quoted text 9 lines
function PDF_get_majorversion:Integer; begin PDF_get_majorversion:=FPDF_get_majorversion(); end; The parentices must be added when calling the function. After that modification the compiler compiles the source code... Is is a compiler-bug?

No, it's a feature.

If you want the delphi/tp mode use {$mode delphi} or {$mode tp} in your source.

Reply by email