A simple calculator built on Microsoft RPC (MIDL). The client and server are separate
executables that talk to each other locally only — the transport is ncalrpc
(Local RPC), so nothing is exposed over the network.
Operations: Add, Subtract, Multiply, Divide.
| File | Purpose |
|---|---|
calc.idl |
Interface definition (the four operations) |
calc.acf |
Attribute config — declares the implicit binding handle |
server.c |
Implements the functions, registers the interface, listens |
client.c |
Binds to CalcEndpoint and calls each function |
calc.h, calc_c.c and calc_s.c are generated by MIDL and are not committed.
From a Developer Command Prompt for VS (or x64 Native Tools prompt):
midl calc.idl
cl server.c calc_s.c /link rpcrt4.lib
cl client.c calc_c.c /link rpcrt4.libStart the server in one terminal:
server.exeThen run the client in another:
client.exeOutput:
2 + 3 = 5
10 - 4 = 6
6 * 7 = 42
20 / 5 = 4
- Division by zero returns
0instead of faulting. - The server runs until you stop it with
Ctrl+C.
