File layout |
Top Previous Next |
What is translated > File layout The interface part and the implementation part of a unit are in Object-Pascal put in one file. In C++ they become a header file and a source file. A file with the minimal frame of a Delphi file which might be called test.pas looks like::
unit test;
interface
implementation
end.
It becomes to test.h :
C++Builder Other Compilers
#ifndef testH #ifndef testH #define testH #define testH
#include <System.hpp> #include "System.h"
#include "d2c_system.h"
namespace test namespace test { {
} // namespace test } // namespace test
#endif // testH #endif // testH
The header file is enclosed into a sentinel. Then for C++Builder System.hpp and d2c_system.h are included or for other compilers System.h..That way the classes, constants and routines which correspond to the according entities of the Delphi system can be used. test.cpp starts with the selected marker for precompiled headers
C++Builder Other Compilers
#include <vcl.h> #include "stdafx.h" // for Visual C++ #pragma hdrstop
#include "test.h" #include "test.h"
using namespace std; using namespace std; using namespace d2c_system; using namespace System; using namespace System;
namespace test namespace test { {
} // namespace test } // namespace test
Thre creation of the test namespace is optional.
If there are uses clauses in the delphi source files the according include directives follow in the C++ files.
Comments can appear at many places in a file,
Variables declared in interface parts are declared extern variables in C++ headers with the implementation in the source file. |
This page belongs to the Delphi2Cpp Documentation |
Delphi2Cpp home Content |