L4Re: C++ or DICE for IPC

Adam Lackorzynski adam at os.inf.tu-dresden.de
Thu Feb 24 07:57:10 CET 2011


On Thu Feb 24, 2011 at 13:49:09 +1200, Valery V. Sedletski wrote:
> On Tue, 22 Feb 2011 11:52:11 +0100, Bj rn D bel wrote:
> >> Is DICE discontinued? And how can I do something with communication code if not using IDL?
> >
> >Yes, Dice has been discontinued and is no longer supported in L4Re.
> >
> >For the moment, you can use the C++ IPC streams provided by L4Re for
> >communication. You can also directly use the C system call bindings for
> >IPC, which requires you to write the marshalling/unmarshalling code
> >manually, though.
> >
> Yes, of course, I knew of such a possibility. I can manually call IPC syscall of L4,
> but here is so much handwork and so it is not desirable.
> >For other programming languages it would for now be necessary to provide
> >some kind of bindings to the C or C++ interfaces. Difficulty varies
> >depending on the language. We're using Lua for configuration purposes
> >and it's easy to call C functions from Lua code.
> >
> I just prefer using C+IDL than C++ because I believe that OOP must be a property of an OS but not a 
> single language, like an approach in IBM's SOM/DSOM. In SOM, applications can be written on
> any language with IDL bindings, and class hierarchy can use a cross-language inheritance (classes
> are encapsulated, so you doesn't have to have a class source for using it, and  you can use a C++ class 
> from a a C program and inherit a C-written class from a
> C++-written one).
> I think, hiding the IPC under C++ iostreams is an interesting approach, but with my point of view,
> not good because it ties a programmer to a single language. (But maybe, someone will make the bindings
> for C somehow?)

The approach 'forces' you to write the actual (un)marshalling code in
C++ but nobody prevents you from doing:

extern "C" int some_func(int some_int, char some_char)
  Ipcstream x();
  x << some_int << some_char;
  return x.ipc(...);

Then you can call some_func from basically everywhere, including other
languages. We use that to have a C interface for L4Re. Of course this is
a bit more work because you need to implement both sides, add a header
file etc. which an IDL compiler would do for you. But experience shows
that this approach is acceptable although an IDL compiler would still be
nice to have.

Adam                 adam at os.inf.tu-dresden.de
  Lackorzynski         http://os.inf.tu-dresden.de/~adam/

More information about the l4-hackers mailing list