[coyotos-dev] Position statement on IDL bindings
Jonathan S. Shapiro
shap at eros-os.com
Sat Jul 7 21:14:23 EDT 2007
So here is my final outcome on all of this:
0. While C++ should be able to call the C binding, there is no intrinsic
reason why C++ should be restricted to the C binding. It is feasible
for C++ to have a distinct binding. It is even feasible for both the
C and the C++ bindings to be accessible for use by C++ code
simultaneously, which supports the case where existing "C++ safe" C
code is being compiled using the C++ compiler.
1. For languages that have native exception handling, IDL exceptions
should turn in to language exceptions, and the nominal return type
of the method should be used as the return type of the stub
procedure.
In the case of procedures returning capabilities, the preferred
implementation will be one of the following:
A. Rotate the return value to the end of the parameter list
as an OUT parameter and change the return type to void.
This is an appropriate simple implementation for C++, for
example.
B. Provide a means, possibly through the IdlEnvironment mechanism
to "allocate" an appropriate location for the return capability.
In this type of binding, the location can be "allocated"
before the call, and the encapsulating language object can
then be returned as the return value.
Which solution is appropriate is highly language dependent. In a
GC'd language, for example, the approach of allocating locations
is probably preferred. In C++, it is possible to imagine an
encapsulating template that uses reference counting on capability
locations.
2. For languages that do NOT have native exception handling, IDL
result codes should be returned by the stub, and the nominal return
type (if not void) should be rotated to the end of the parameter
list.
This averts certain initialization errors, and makes error checking
simpler and more consistent.
3. For compatibility with existing CORBA-based C code, provide a new
back end for the existing IDL compiler. Solve the problem of
capability return values by rotating those to the last parameter
position. Otherwise use the binding currently used by those
environments.
--
Jonathan S. Shapiro, Ph.D.
Managing Director
The EROS Group, LLC
More information about the coyotos-dev
mailing list