summaryrefslogtreecommitdiff
path: root/TAO/docs/compiler.html
blob: f7839b76642d64b7c9d5cbc278b1f0b742140022 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="GENERATOR" content="Mozilla/4.5 [en] (X11; I; SunOS 5.5.1 sun4u) [Netscape]">
<title>TAO IDL compiler User's Guide</title>
<!-- $Id$ -->
</head>
<body text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#CC0000">

<hr>
<h3>
TAO IDL compiler User's Guide</h3>

<h2> Scope</h2> This document describes the options and features of
TAO IDL compiler.  It is not a reference manual or tutorial on OMG
IDL.  For more information on OMG IDL see the <A
HREF="http://www.omg.org/library/c2indx.html">online CORBA
specification</A> and the <A
HREF="http://www.triodia.com/staff/michi-henning.html">Advanced CORBA
Programming with C++</A> book. <P>

<HR><P>
<h3>Generated Files</h3>

The IDL compiler generates 9 files from each <tt>.idl</tt> file.  The
file names are obtained by taking the IDL <EM>basename</EM> and
appending the following suffixes (see the list of TAO's IDL compiler
<A HREF="#options">options</A> on how to get different suffixes for
these files:) <P>

<UL>
  <LI> <EM>Client stubs</EM> -- <tt>*C.h</tt>, <tt>*C.i</tt>, and <tt>*C.cpp</tt>
  <LI> <EM>Server skeletons</EM> -- <tt>*S.h</tt>, <tt>*S.i</tt>, and
      <tt>*S.cpp</tt>
  <LI> <EM>Server skeleton templates </EM> -- <tt>*S_T.h</tt>, <tt>S_T.i</tt>,
      and <tt>*S_T.cpp</tt>
</UL>

TAO's IDL compiler creates separate <TT>*.i</TT> and <TT>*S_T.*</TT>
files to improve the performance of the generated code.  Fortunately,
you only need to <CODE>#include</CODE> the client stubs declared in
the <tt>*C.h</tt> file and the skeletons in the <tt>*S.h</tt> file in
your code. <P>

<HR><P>
<a name="idl_env"><h3>Environment Variables</h3></a>
TAO_IDL looks for two environment variables <code>CPP_LOCATION</code>
and <code>TAO_IDL_DEFAULT_CPP_FLAGS</code>.  TAO_IDL doesn't
implements its own preprocessor and it borrows the preprocessor of
the compiler of your choice to perform the preprocessing work.
On most platform TAO's makefiles can locate the compiler
automatically.  However, on NT and some other situation (like cross
compiling,) you need to instruct which specific compiler to use.
<code>CPP_LOCATION</code> allows you to achieve this.  It holds the
program name of the compiler that TAO_IDL uses.  This should be a full
pathname if the compiler is not within your <code>$PATH</code>.

TAO_IDL also defines a set of default command line options passed to
the preprocessor depending on which platform TAO_IDL is compiled.  The
environment variable <CODE>TAO_IDL_DEFAULT_CPP_FLAGS</CODE> allows you
to alter the command line optiona passed to the preprocessor.  You can
use it to alter the default options for the preprocessor and specify
things like include directories and how the preprocessor is invoked.
Two flags that won't get overwritten by the environment variable are
<code>-DIDL</code> and <code>-I.</code>.  They are always passed to
the preprocessor.

If your IDLs need to include <code>&lt;orb.idl&gt;</code>, then you need to
define either/both <code>ACE_ROOT</code> or/and <code>TAO_ROOT</code>.  If you
already have <CODE>ACE_ROOT</CODE> defined, TAO_IDL can figure
<CODE>TAO_ROOT</CODE> out if your ACE/TAO was installed using default directory
structure, otherwise, you'll need to define <code>TAO_ROOT</code>.

<HR><P>
<h3>Operation Demuxing Strategies</h3>

The server skeleton can use different demuxing strategies to match the
incoming operation with the correct operation at the servant.  TAO's
IDL compiler supports perfect hashing, binary search, and dynamic
hashing demuxing strategies.  By default, TAO's IDL compiler tries to
generate perfect hash functions, which is generally the most <A
HREF="http://www.cs.wustl.edu/~schmidt/COOTS-99.ps.gz">efficient and
predictable operation demuxing technique</A>.  To generate perfect
hash functions, TAO's IDL compiler uses <a
href="http://www.cs.wustl.edu/~schmidt/gperf.ps.gz">gperf </a>, which
is a general-purpose perfect hash function generator. <P>

To configure TAO's IDL compiler to support perfect hashing please do
the following:

<ul>
  <LI>Enable <CODE>ACE_HAS_GPERF</CODE> when building ACE and TAO.
      This macro has been defined for the platforms where <CODE>gperf</CODE>
      has been tested, which includes most <A
      HREF="http://www.cs.wustl.edu/~schmidt/ACE-versions-i.html">platforms</A>
      that ACE runs on. <P>

  <li>Build the <CODE>gperf</CODE> in $ACE_ROOT/apps/gperf.  This build
      also leaves a copy/link of the gperf program at the $ACE_ROOT/bin
      directory.<P>

  <li>Set the environment variable $ACE_ROOT appropriately or add
      $ACE_ROOT/bin to your search path. <P>

  <li>Use the <CODE>-g</CODE> option for the TAO IDL compiler or set
      your search path accordingly to install <CODE>gperf</CODE> in a
      directory other than $ACE_ROOT/bin.
</ul>

Note that if you can't use perfect hashing for some reason the next
best operation demuxing strategy is binary search, which can be
configured using TAO's IDL compiler <A HREF="#options">options</A>.<P>

<hr><p>
<h3><a name="collocation-stubs">Collocation Strategies</a></h3>

TAO_IDL can generate collocated stubs using two different collocation
strategies.  It also allows you to supress/enable the generation of
the stubs of a particular strategy.  To gain great flexibility at
run-time, you can gereate stubs for both collocation strategies
(using both '<a href="#Gp"><code>-Gp</code></a>' and '<a
href="#Gd"><code>-Gd</code></a>' flags at the same time) and defer the
determination of collocation strategy until run-time.  On the other
hand, if you want to minimize the footprint of your program, you might
want to pre-determine the collocation strategy you want and only
generate the right collocated stubs (or not generating any at all using
both  '<a href="#Sp"><code>-Sp</code></a>' and '<a
href="#Sd"><code>-Sd</code></a>' flags at the same time if
it's a pure client.)  See our <a
href="http://www.cs.wustl.edu/~schmidt/C++-report-col18.ps.gz">collocation
paper</a> for a detail discussion on the collocation support in
TAO.<p>


<HR><P>
<h3><A NAME="options">TAO's IDL Compiler Options</A></h3>

TAO's IDL compiler invokes your <tt>C</tt> (or <tt>C++</tt>)
preprocessor to resolve included IDL files.  It receives the common
options for preprocessors (such as <tt>-D</tt> or <tt>-I</tt>).  It
also receives other options that are specific to it. <P>

<table BORDER=2 CELLSPACING=2 CELLPADDING=0 >
  <tr>
    <th>Option</th>
    <th>Description</th>
    <th>Remark</th>
  </tr>
  <tr><a NAME="u">
    <td><tt>-u</tt></td>

    <td>The compiler prints out the options that are given below and exits
        clean </td>
    <td>&nbsp;</td>
  </tr>

  <tr> <a NAME="V">
    <td><tt>-V</tt></td>

    <td>The compiler printouts its version and exits</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="Wb">
    <td><tt>-Wb,</tt><i>option_list</i></EM</TD></td>

    <td>Pass options to the TAO IDL compiler backend.</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="skel_export_macro">
    <td></td>

    <td><tt>skel_export_macro=</tt><i>macro_name</i></td>

    <td>The compiler will emit <i>macro_name</i> right after each <tt>class</tt>
        or <tt>extern</tt> keyword in the generated skeleton code (S
        files,) this is needed for Windows/NT that requires
        special directives to export symbols from DLLs, usually the definition
        is just a space on unix platforms.&nbsp;</td>
  </tr>

  <tr><a name="skel_export_include">
    <td></td>

    <td><tt>skel_export_include=</tt><i>include_path</i></td>

    <td>The compiler will generate code to include <i>include_path</i> at the
        top of the generated server header, this is usually a good
        place to define the server side export macro.</td>
  </tr>

  <tr><a name="stub_export_macro">
    <td></td>

    <td><tt>stub_export_macro=</tt><i>macro_name</i></td>

    <td>The compiler will emit <i>macro_name</i> right after each <tt>class</tt>
        or <tt>extern</tt> keyword in the generated stub code, this is
        needed for Windows/NT that requires special directives to
        export symbols from DLLs, usually the definition is just a
        space on unix platforms.&nbsp;</td>
  </tr>

  <tr><a name="stub_export_include">
    <td></td>

    <td><tt>stub_export_include=</tt><i>include_path</i></td>

    <td>The compiler will generate code to include <i>include_path</i> at the
        top of the client header, this is usually a good place to define the export
        macro.</td>
  </tr>

  <tr><a name="export_macro">
    <td></td>

    <td><tt>export_macro=</tt><i>macro_name</i></td>

    <td>This option has the same effect as issuing
        <tt>-Wb,skel_export_macro=</tt><i>macro_name</i>
        <tt>-Wb,stub_export_macro=</tt><i>macro_name</i>.  This option
        is useful when building a DLL containing both stubs and
        skeletons.</td>
  </tr>

  <tr><a name="export_include">
    <td></td>

    <td><tt>export_include=</tt><i>include_path</i></td>

    <td>This option has the same effect as specifying
        <tt>-Wb,stub_export_include=</tt><i>include_path</i>.  This
        option goes with the previous option to build DLL containing
        both stubs and skeletons.</td>
  </tr>

  <tr><a name="pch_include">
    <td></td>

    <td><tt>pch_include=</tt><i>include_path</i></td>

    <td>The compiler will generate code to include <i>include_path</i> at the
        top of all TAO IDL compiler generated files.  This can be used with a
        precompiled header mechanism, such as those provided by Borland
        C++Builder or MSVC++.</td>
  </tr>

  <tr><a name="E">
    <td><tt>-E</tt></td>

    <td>Only invoke the preprocessor</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="Wp">
    <td><tt>-Wp,</tt><i>option_list</i></EM</TD></td>

    <td>Pass options to the preprocessor.</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="D">
    <td><tt>-D</tt><i>macro_definition</i></td>

    <td>It is passed to the preprocessor</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="U">
    <td><tt>-U</tt><i>macro_name</i></td>

    <td>It is passed to the preprocessor</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="I">
    <td><tt>-I</tt><i>include_path</i></td>

    <td>It is passed to the preprocessor</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="A">
    <td><tt>-A</tt><i>assertion</i></td>

    <td>It is passed to the preprocessor</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="Y">
    <td><tt>-Y</tt></td>

    <td>It is passed to the preprocessor</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="H perfect_hash">
    <td><tt>-H perfect_hash</tt></td>

    <td>To specify the IDL compiler to generate skelton code that uses perfect
        hashed operation demuxing strategy, which is the default strategy. Perfect
        hashing uses <a href="http://www.cs.wustl.edu/~schmidt/gperf.ps.gz">gperf
        </a>program,
        to generate demuxing methods.&nbsp;</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="H dynamic_hash">
    <td><tt>-H dynamic_hash</tt></td>

    <td>To specify the IDL compiler to generate skelton code that uses dynamic
        hashed operation demuxing strategy.&nbsp;</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="H binary_search">
    <td><tt>-H binary_search</tt></td>

    <td>To specify the IDL compiler to generate skelton code that uses binary
        search based operation demuxing strategy.&nbsp;</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="H linear_search">
    <td><tt>-H linear_search</tt></td>

    <td>To specify the IDL compiler to generate skelton code that uses linear
        search based operation demuxing strategy.  Note that this option is for testing purposes only and should not be used for production code since it's inefficient.</td>
    <td>&nbsp;</td>
  </tr>


  <tr><a name="in">
    <TD><TT>-in</TT></TD>
    <TD> To generate #include statements with <>'s for the standard
        include files (e.g. tao/corba.h) indicating them as non-changing
        files</TD>
    <td>&nbsp;</td>
  </TR>


  <TR><A NAME="ic">
    <TD><TT>-ic</TT></TD>
    <TD> To generate #include statements with ""s for changing
        standard include files (e.g. tao/corba.h). </TD>
    <td>&nbsp;</td>
  </TR>

  <tr><a name="g">
    <td><tt>-g</tt></td>

    <td>To specify the path for the perfect hasing program (GPERF). Default
        is $ACE_ROOT/bin/gperf.&nbsp;</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="o">
    <td><tt>-o</tt></td>

    <td>To specify the output directory to IDL compiler as to where all the
        IDL-compiler-generated files are to be put. By default, all the files are
        put in the current directory from where&nbsp;<tao_idl>is called.&nbsp;</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="hc">
    <td><tt>-hc</tt></td>

    <td>Client's header file name ending. Default is "C.h".</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="hs">
    <td><tt>-hs</tt></td>

    <td>Server's header file name ending. Default is "S.h".</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="hT">
    <td><tt>-hT</tt></td>

    <td>Server's template header file name ending. Default is "S_T.h".</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="cs">
    <td><tt>-cs</tt></td>

    <td>Client stub's file name ending. Default is "C.cpp".</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="ci">
    <td><tt>-ci</tt></td>

    <td>Client inline file name ending. Default is "C.i".</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="ss">
    <td><tt>-ss</tt></td>

    <td>Server skeleton file name ending. Default is "S.cpp".</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="sT">
    <td><tt>-sT</tt></td>

    <td>Server template skeleton file name ending. Default is "S_T.cpp".</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="si">
    <td><tt>-si</tt></td>

    <td>Server inline skeleton file name ending. Default is "S.i".</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="st">
    <td><tt>-st</tt></td>

    <td>Server's template inline file name ending. Default is "S_T.i".</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="t">
    <td><tt>-t</tt></td>

    <td>Temporary directory to be used by the IDL compiler. Default :
        Resolve ACE_DEFAULT_TEMP_DIR_ENV. If it is not defined, choose
        /tmp/.
    </td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="Cw">
    <td><tt>-Cw</tt></td>

    <td>Output a warning if two identifiers in the same scope differ in
        spelling only by case (default for now).</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="Ce">
    <td><tt>-Ce</tt></td>

    <td>Output an error if two indentifiers in the same scope differ in
        spelling only by case. Default output is warning (for now).</td>

    <td>Since there is at least one OMG IDL file (sfp.idl, part of the
        AVStreams specification) that is inconsistent with its own spelling
        rule, we have made a warning the default output until the issue
        is resolved.</td>
  </tr>

  <tr><a name="Gc">
    <td><tt>-Gc</tt></td>

    <td>Generate stubs and skeletons using compiled marshaling&nbsp;</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="Gi">
    <td><tt>-Gi</tt></td>

    <td>Generate stubs and skeletons using interpretive marshaling (default
        for now)&nbsp;</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="Ge flag">
    <td><tt>-Ge </tt><i>flag</i></td>

    <td>If the value of the flag is 0, tao_idl will generate code that
        will use native C++ exceptions. If the value of the flag is 1,
        tao_idl will generate code that will use environment variable for
        passing exceptions </td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="Gl flag">
    <td><tt>-Gl </tt></td>

    <td><b>For TAO Core developer only</b>.  Generate <em>locality
        constraint</em> interface implementation.  This flag is not of
        general interests and should never be used by end-users.
    </td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="Gp">
    <td><tt>-Gp </tt></td>

    <td>Generated collocated stubs that use <code>Thru_POA</code> collocation strategy (default)</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="Gd">
    <td><tt>-Gd </tt></td>

    <td>Generated collocated stubs that use <code>Direct</code> collocation strategy</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="Gt">
    <td><tt>-Gt</tt></td>

    <td>Generate optimized TypeCodes (unimplemented as yet)</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="Gv">
    <td><tt>-Gv</tt></td>

    <td>Generate code that suppports Object-By-Value</td>
    <td>&nbsp;</td>
  </tr>

  <tr>
    <td>-<tt>GI</tt></td>

    <td>Generate templates files for the servant implementation </td>
    <td>&nbsp;</td>
  </tr>

  <tr>
    <td><tt>-GIh </tt><i>arg</i></td>

    <td>Servant implemenation header file name ending</td>
    <td>&nbsp;</td>
  </tr>

  <tr>
    <td><tt>-GIs </tt><i>arg</i></td>

    <td>Servant implemenation skeleton file name ending</td>
    <td>&nbsp;</td>
  </tr>

  <tr>
    <td><tt>-GIb </tt><i>arg</i></td>

    <td>Prefix to the implementation class names</td>
    <td>&nbsp;</td>
  </tr>

  <tr>
    <td><tt>-GIe </tt><i>arg</i></td>

    <td>Suffix to the implementation class names</td>
    <td>&nbsp;</td>
  </tr>

  <tr>
    <td><tt>-GIc </tt><i>arg</i></td>

    <td>Generate copy constructors in the servant implementation template files</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="Sa">
    <td><tt>-Sa</tt></td>

    <td>Suppress generation of the Any operators</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="Sp">
    <td><tt>-Sp</tt></td>

    <td>Suppress generation of collocated stubs that use <code>Thru_POA</code> collocation strategy</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="Sd">
    <td><tt>-Sd</tt></td>

    <td>Suppress generation of collocated stubs that use <code>Direct</code> collocation strategy (default)</td>
    <td>&nbsp;</td>
  </tr>

  <tr><a name="St">
    <td><tt>-St</tt></td>

    <td>Suppress generation of the TypeCodes</td>
    <td>&nbsp;</td>
  </tr>
</table> <P>

<P><HR><P>
Back to the TAO <A HREF="index.html">documentation</A>.

<!--#include virtual="/~schmidt/cgi-sig.html" -->

</body>
</html>