Forum > Beginners

Redefine interface

(1/1)

quantumfoam:
I'm trying to translate C++ header files into Pascal. There is lot of cases where interface (just name) is defined:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---INTF1 = interface;
Then it is used in some completely defined interface:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---INTF2 = interface(INTF_BASE) function intf2_a(p:INTF1):int; stdcall;end; 
And lastly, the interface is fully defined:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---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?

marcov:
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?

quantumfoam:
The error was "Duplicate identifier". And the reason was, I had the forward declaration in reality defined like


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---INTF1 = interface end;
not as actually wrote in question


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---INTF1 = interface;
These damn Pascal beginners. :) Thanks.

Navigation

[0] Message Index

Go to full version