Name
$HppEmit Compiler Directive
Syntax
(*$HppEmit String
*)
Scope
Local
Description
Use the
$HppEmit
compiler directive to write String
in the
.hpp file for C++ Builder. The string is written
to the user-supplied section at the top of the file. All the
$HppEmit
strings appear in the same order as their
appearance in the .pas
file.
You can use $HppEmit
to include any text you want
in the .hpp file, from additional
#include
directives to type declarations.
Example
type TComplex = record Re, Im: Double; end; // Define the structure differently in C++. // Note the use of { and } in the HppEmit code, which would interfere // in Pascal comments that use { and } because the comments do not // recognize quoted strings. Use (* and *) instead. {$ExternalSym TComplex} (*$HppEmit 'struct TComplex {'*) (*$HppEmit ' double Re;'*) (*$HppEmit ' double Im;'*) (*$HppEmit ' TComplex(double r=0, double i=0) : Re(r), Im(i) {}'*) (*$HppEmit '};'*)
See Also
$ExternalSyms Compiler Directive, $NoDefine Compiler Directive, $NoInclude Compiler Directive |
Get Delphi in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.