<s>
A	O
stub	B-Operating_System
in	O
distributed	B-Architecture
computing	I-Architecture
is	O
a	O
piece	O
of	O
code	O
that	O
converts	O
parameters	O
passed	O
between	O
client	B-Protocol
and	O
server	B-Application
during	O
a	O
remote	B-Operating_System
procedure	I-Operating_System
call	I-Operating_System
(	O
RPC	B-Operating_System
)	O
.	O
</s>
<s>
The	O
main	O
idea	O
of	O
an	O
RPC	B-Operating_System
is	O
to	O
allow	O
a	O
local	O
computer	O
(	O
client	B-Protocol
)	O
to	O
remotely	O
call	O
procedures	O
on	O
a	O
different	O
computer	O
(	O
server	B-Application
)	O
.	O
</s>
<s>
The	O
client	B-Protocol
and	O
server	B-Application
use	O
different	O
address	B-General_Concept
spaces	I-General_Concept
,	O
so	O
parameters	O
used	O
in	O
a	O
function	O
(	O
procedure	O
)	O
call	O
have	O
to	O
be	O
converted	O
,	O
otherwise	O
the	O
values	O
of	O
those	O
parameters	O
could	O
not	O
be	O
used	O
,	O
because	O
pointers	O
to	O
parameters	O
in	O
one	O
computer	O
's	O
memory	O
would	O
point	O
to	O
different	O
data	O
on	O
the	O
other	O
computer	O
.	O
</s>
<s>
The	O
client	B-Protocol
and	O
server	B-Application
may	O
also	O
use	O
different	O
data	O
representations	O
,	O
even	O
for	O
simple	O
parameters	O
(	O
e.g.	O
,	O
big-endian	O
versus	O
little-endian	O
for	O
integers	O
)	O
.	O
</s>
<s>
Stubs	B-Operating_System
perform	O
the	O
conversion	O
of	O
the	O
parameters	O
,	O
so	O
a	O
remote	B-Operating_System
procedure	I-Operating_System
call	I-Operating_System
looks	O
like	O
a	O
local	O
function	O
call	O
for	O
the	O
remote	O
computer	O
.	O
</s>
<s>
Stub	B-Operating_System
libraries	O
must	O
be	O
installed	O
on	O
both	O
the	O
client	B-Protocol
and	O
server	B-Application
side	O
.	O
</s>
<s>
A	O
client	B-Protocol
stub	B-Operating_System
(	O
sometimes	O
called	O
proxy	O
)	O
is	O
responsible	O
for	O
conversion	O
(	O
marshalling	B-Application
)	O
of	O
parameters	O
used	O
in	O
a	O
function	O
call	O
and	O
deconversion	O
of	O
results	O
passed	O
from	O
the	O
server	B-Application
after	O
execution	O
of	O
the	O
function	O
.	O
</s>
<s>
A	O
server	B-Application
skeleton	O
,	O
the	O
stub	B-Operating_System
on	O
the	O
server	B-Application
side	O
,	O
is	O
responsible	O
for	O
deconversion	O
of	O
parameters	O
passed	O
by	O
the	O
client	B-Protocol
and	O
conversion	O
of	O
the	O
results	O
after	O
the	O
execution	O
of	O
the	O
function	O
.	O
</s>
<s>
Stubs	B-Operating_System
can	O
be	O
generated	O
in	O
one	O
of	O
two	O
ways	O
:	O
</s>
<s>
Manually	O
:	O
In	O
this	O
method	O
,	O
the	O
RPC	B-Operating_System
implementer	O
provides	O
a	O
set	O
of	O
translation	O
functions	O
from	O
which	O
a	O
user	O
can	O
construct	O
his	O
or	O
her	O
own	O
stubs	B-Operating_System
.	O
</s>
<s>
Automatically	O
:	O
This	O
is	O
the	O
more	O
commonly	O
used	O
method	O
for	O
stub	B-Operating_System
generation	O
.	O
</s>
<s>
It	O
uses	O
an	O
interface	B-General_Concept
description	I-General_Concept
language	I-General_Concept
(	O
IDL	O
)	O
to	O
define	O
the	O
interface	O
between	O
client	B-Protocol
and	O
server	B-Application
.	O
</s>
<s>
For	O
example	O
,	O
an	O
interface	O
definition	O
has	O
information	O
to	O
indicate	O
whether	O
each	O
argument	O
is	O
input	O
,	O
output	O
or	O
both	O
;	O
only	O
input	O
arguments	O
need	O
to	O
be	O
copied	O
from	O
client	B-Protocol
to	O
server	B-Application
and	O
only	O
output	O
elements	O
need	O
to	O
be	O
copied	O
from	O
server	B-Application
to	O
client	B-Protocol
.	O
</s>
<s>
A	O
server	B-Application
program	O
that	O
implements	O
a	O
procedure	O
in	O
an	O
interface	O
is	O
said	O
to	O
export	O
the	O
interface	O
and	O
a	O
client	B-Protocol
program	I-Protocol
that	O
calls	O
procedures	O
from	O
an	O
interface	O
is	O
said	O
to	O
import	O
the	O
interface	O
.	O
</s>
<s>
When	O
writing	O
a	O
distributed	B-Architecture
application	I-Architecture
,	O
a	O
programmer	O
first	O
writes	O
an	O
interface	O
definition	O
using	O
the	O
IDL	O
,	O
then	O
programmers	O
can	O
write	O
the	O
client	B-Protocol
program	I-Protocol
that	O
imports	O
the	O
interface	O
and	O
the	O
server	B-Application
program	O
that	O
exports	O
the	O
interface	O
.	O
</s>
<s>
The	O
interface	O
definition	O
is	O
processed	O
using	O
an	O
IDL	O
compiler	O
to	O
generate	O
components	O
that	O
can	O
be	O
combined	O
with	O
client	B-Protocol
and	O
server	B-Application
programs	O
,	O
without	O
making	O
any	O
changes	O
to	O
the	O
existing	O
compilers	O
.	O
</s>
<s>
In	O
particular	O
,	O
from	O
an	O
interface	O
for	O
each	O
procedure	O
in	O
the	O
interface	O
,	O
the	O
compiler	O
generates	O
the	O
appropriate	O
marshalling	B-Application
and	O
unmarshalling	O
operations	O
in	O
each	O
stub	B-Operating_System
procedure	O
and	O
a	O
header	O
file	O
that	O
supports	O
the	O
data	O
types	O
in	O
the	O
interface	O
definition	O
.	O
</s>
<s>
The	O
header	O
file	O
is	O
included	O
in	O
the	O
source	O
files	O
of	O
both	O
the	O
client	B-Protocol
and	O
server	B-Application
programs	O
,	O
the	O
client	B-Protocol
stub	B-Operating_System
procedures	O
are	O
compiled	O
and	O
linked	O
with	O
the	O
client	B-Protocol
program	I-Protocol
,	O
and	O
the	O
server	B-Application
stub	B-Operating_System
procedures	O
are	O
compiled	O
and	O
linked	O
with	O
the	O
server	B-Application
program	O
.	O
</s>
<s>
An	O
IDL	O
compiler	O
can	O
be	O
designed	O
to	O
process	O
interface	O
definitions	O
for	O
use	O
with	O
different	O
languages	O
,	O
enabling	O
clients	O
and	O
servers	O
written	O
in	O
different	O
languages	O
to	O
communicate	O
using	O
remote	B-Operating_System
procedure	I-Operating_System
calls	I-Operating_System
.	O
</s>
<s>
To	O
achieve	O
the	O
goal	O
of	O
semantics	O
transparency	O
,	O
designers	O
have	O
made	O
RPC	B-Operating_System
look	O
like	O
LPC	B-Operating_System
using	O
the	O
concept	O
of	O
stubs	B-Operating_System
that	O
hide	O
the	O
actual	O
RPC	B-Operating_System
implementation	O
from	O
the	O
programs	O
the	O
interface	O
to	O
the	O
underlying	O
RPC	B-Operating_System
system	O
.	O
</s>
