Sign in Join

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

Mailing lists / fpc-devel / 2004-11

external problem

7 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

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

Unknown author

------------------------------------------------------------- ...
implementation

{$LINK dfc.ow}   //GCC object file style

procedure dfCrap(setoperation: Tso); cdecl; external; ...
-------------------------------------------------------------

Hi!
The lines above do compile and work fine under previous versions of FPC. With the latest version of FPC I got the following error message:

Free Pascal Compiler version 1.9.5 [2004/11/24] for i386
dfTools.pas(107,11) Error: Can't declare procedure as EXTERNAL

Has there something changed?

2nd Problem:
-------------------------------------------------- The line
-Fud:\fpc/units/i386-$TARGET/*
won't be regonized correctly. The path is not found by FPC. Instead I have to write
-Fud:\fpc/units/i386-win32/*
That seems to be broken. ???

-
Ralf

Reply by email

Peter Vreman
to Unknown author
Show quoted text 18 lines
------------------------------------------------------------- ... implementation {$LINK dfc.ow} //GCC object file style procedure dfCrap(setoperation: Tso); cdecl; external; ... ------------------------------------------------------------- Hi! The lines above do compile and work fine under previous versions of FPC. With the latest version of FPC I got the following error message: Free Pascal Compiler version 1.9.5 [2004/11/24] for i386 dfTools.pas(107,11) Error: Can't declare procedure as EXTERNAL Has there something changed?

Yes, there is also a declaration in the interface. You can't declare a procedure external in the implementation anymore when the interface says that is needs to have a body. There is an exception for win32 and os/2 regarding to DLL imports.

Show quoted text 9 lines
2nd Problem: -------------------------------------------------- The line -Fud:\fpc/units/i386-$TARGET/* won't be regonized correctly. The path is not found by FPC. Instead I have to write -Fud:\fpc/units/i386-win32/* That seems to be broken. ???

Mail was send to fpc-devel for this change

Reply by email

Unknown author
to Peter Vreman
interface
procedure dfCrap(setoperation: Tso); cdecl;
implementation
{$LINK dfc.ow}   //GCC object file style
procedure dfCrap(setoperation: Tso); cdecl; external;
...

The declaration does exist in the interface!
BTW: I am working under Win32.

Peter Vreman wrote 28 lines
>------------------------------------------------------------- >... >implementation > >{$LINK dfc.ow} //GCC object file style > >procedure dfCrap(setoperation: Tso); cdecl; external; >... >------------------------------------------------------------- > >Hi! >The lines above do compile and work fine under previous versions of FPC. >With the latest version of FPC I got the following error message: > >Free Pascal Compiler version 1.9.5 [2004/11/24] for i386 >dfTools.pas(107,11) Error: Can't declare procedure as EXTERNAL > >Has there something changed? > > Yes, there is also a declaration in the interface. You can't declare a procedure external in the implementation anymore when the interface says that is needs to have a body. There is an exception for win32 and os/2 regarding to DLL imports.

Reply by email

peter green
to Unknown author

just move what you presently have in the implementation to the interface and remove what you currently have in the interface

Show quoted text 60 lines
-----Original Message----- From: Behalf Of Sent: 25 November 2004 17:19 To: FPC developers' list Subject: Re: [fpc-devel] external problem interface procedure dfCrap(setoperation: Tso); cdecl; implementation {$LINK dfc.ow} //GCC object file style procedure dfCrap(setoperation: Tso); cdecl; external; ... The declaration does exist in the interface! BTW: I am working under Win32. Peter Vreman wrote: >>------------------------------------------------------------- >>... >>implementation >> >>{$LINK dfc.ow} //GCC object file style >> >>procedure dfCrap(setoperation: Tso); cdecl; external; >>... >>------------------------------------------------------------- >> >>Hi! >>The lines above do compile and work fine under previous versions of FPC. >>With the latest version of FPC I got the following error message: >> >>Free Pascal Compiler version 1.9.5 [2004/11/24] for i386 >>dfTools.pas(107,11) Error: Can't declare procedure as EXTERNAL >> >>Has there something changed? >> >> > >Yes, there is also a declaration in the interface. You can't declare a >procedure external in the implementation anymore when the interface says >that is needs to have a body. There is an exception for win32 and os/2 >regarding to DLL imports. > > > _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email

Tomas Hajny
to Unknown author: interface procedure dfCrap(setoperation: Tso); cdecl; implementation {$LINK dfc.ow} …

On Thu, 25 Nov 2004 18:18:45 +0100, rstar wrote

Show quoted text 12 lines
interface procedure dfCrap(setoperation: Tso); cdecl; implementation {$LINK dfc.ow} //GCC object file style procedure dfCrap(setoperation: Tso); cdecl; external; ... The declaration does exist in the interface!

Yes, that's the problem. You either need to remove the declaration from interface altogether, or move the complete declaration including import specification from implementation to interface.

BTW: I am working under Win32.

However, you don't import the procedure from a DLL - see Peter's e-mail below.

Tomas

Show quoted text 27 lines
Peter Vreman wrote: >>------------------------------------------------------------- >>... >>implementation >> >>{$LINK dfc.ow} //GCC object file style >> >>procedure dfCrap(setoperation: Tso); cdecl; external; >>... >>------------------------------------------------------------- >> >>Hi! >>The lines above do compile and work fine under previous versions of FPC. >>With the latest version of FPC I got the following error message: >> >>Free Pascal Compiler version 1.9.5 [2004/11/24] for i386 >>dfTools.pas(107,11) Error: Can't declare procedure as EXTERNAL >> >>Has there something changed? >> >> > >Yes, there is also a declaration in the interface. You can't declare a >procedure external in the implementation anymore when the interface says >that is needs to have a body. There is an exception for win32 and os/2 >regarding to DLL imports.

Reply by email

Peter Vreman
to Unknown author: interface procedure dfCrap(setoperation: Tso); cdecl; implementation {$LINK dfc.ow} …
Show quoted text 14 lines
interface procedure dfCrap(setoperation: Tso); cdecl; implementation {$LINK dfc.ow} //GCC object file style procedure dfCrap(setoperation: Tso); cdecl; external; ... The declaration does exist in the interface! BTW: I am working under Win32.

You aren't importing from a DLL, so Win32 has the same rules.

The problem is that the interface declaration sets the assembler name to something like U_UNITNAME_DFCRAP$TSO. The implementation declaration changes the assembler name to _dfCrap. This gives problems when the procedure was already called (from other units) before the implementation declaration is parsed.

Reply by email

Unknown author
to Tomas Hajny: On Thu, 25 Nov 2004 18:18:45 +0100, rstar wrote Yes, that's the problem. You either need…

You cannot declare procedures in the interface section.

Tomas Hajny wrote 75 lines
On Thu, 25 Nov 2004 18:18:45 +0100, rstar wrote >interface > >procedure dfCrap(setoperation: Tso); cdecl; > >implementation > >{$LINK dfc.ow} //GCC object file style > >procedure dfCrap(setoperation: Tso); cdecl; external; >... > >The declaration does exist in the interface! > > Yes, that's the problem. You either need to remove the declaration from interface altogether, or move the complete declaration including import specification from implementation to interface. >BTW: I am working under Win32. > > However, you don't import the procedure from a DLL - see Peter's e-mail below. Tomas >Peter Vreman wrote: > > > >>>------------------------------------------------------------- >>>... >>>implementation >>> >>>{$LINK dfc.ow} //GCC object file style >>> >>>procedure dfCrap(setoperation: Tso); cdecl; external; >>>... >>>------------------------------------------------------------- >>> >>>Hi! >>>The lines above do compile and work fine under previous versions of FPC. >>>With the latest version of FPC I got the following error message: >>> >>>Free Pascal Compiler version 1.9.5 [2004/11/24] for i386 >>>dfTools.pas(107,11) Error: Can't declare procedure as EXTERNAL >>> >>>Has there something changed? >>> >>> >>> >>> >>Yes, there is also a declaration in the interface. You can't declare a >>procedure external in the implementation anymore when the interface says >>that is needs to have a body. There is an exception for win32 and os/2 >>regarding to DLL imports. >> >> _______________________________________________ fpc-devel maillist - http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply by email