Lazarus
Free Pascal => Beginners => Topic started by: quantumfoam on October 27, 2021, 02:49:22 pm
Title:
Redefine interface
Post by:
quantumfoam
on
October 27, 2021, 02:49:22 pm
I'm trying to translate C++ header files into Pascal. There is lot of cases where interface (just name) is defined:
Code: Pascal
[Select]
[+]
[-]
INTF1
=
interface
;
Then it is used in some completely defined interface:
Code: Pascal
[Select]
[+]
[-]
INTF2
=
interface
(
INTF_BASE
)
function
intf2_a
(
p
:
INTF1
)
:
int
;
stdcall
;
end
;
And lastly, the interface is fully defined:
Code: Pascal
[Select]
[+]
[-]
INTF1
=
interface
(
INTF_BASE
)
function
intf1_x
:
int
;
stdcall
;
end
;
When I try to do this in Free Pascal, I get Duplicate identifier error. How can I redefine interface?
Title:
Re: Redefine interface
Post by:
marcov
on
October 27, 2021, 04:19:06 pm
The first declaration is a forward define, and the INTF1 declaration later is fine.
If not, what is your exact code, and what exact error do you get?
Title:
Re: Redefine interface
Post by:
quantumfoam
on
October 27, 2021, 04:53:06 pm
The error was "Duplicate identifier". And the reason was, I had the forward declaration in reality defined like
Code: Pascal
[Select]
[+]
[-]
INTF1
=
interface
end
;
not as actually wrote in question
Code: Pascal
[Select]
[+]
[-]
INTF1
=
interface
;
These damn Pascal beginners. :) Thanks.
TinyPortal
© 2005-2018