Re: [capnproto] How to get server-side implementation from client capability ?

2021-04-29 Thread Théophile B .
Ok I see, generated headers indeed include capnproto/kj headers, so Cap'n Proto would be a public dependency of my library. The version mismatch issue could be solved by using a CMake package, with the right version of Cap'n Proto required in the CMake configuration file. Based on all this, I

Re: [capnproto] How to get server-side implementation from client capability ?

2021-04-28 Thread 'Kenton Varda' via Cap'n Proto
I would say that when you are distributing a precompiled binary copy of your library, you should distribute the `.capnp.h` header along with it, if you want programs using your library to be able to use that type. Those programs will need to link against the exact version of the schema that you

Re: [capnproto] How to get server-side implementation from client capability ?

2021-04-27 Thread Théophile B .
It works ! Thank you for the expanded explanation, it helped a lot. I initially though there would be a "prettier" out-of-the-box solution, but as long as it works... While I have you, I have a more general question. Is it common case to distribute Cap'n'Proto genererated headers as part of a

Re: [capnproto] How to get server-side implementation from client capability ?

2021-04-26 Thread 'Kenton Varda' via Cap'n Proto
You need your `SubscriberImpl` to hold a regular C++ pointer back to the `MediaLibraryImpl` that created it, so that you can access its `publishers_` set through that pointer. You can pass the pointer to `SubscriberImpl`'s constructor. You'll also want to make sure the pointer doesn't become a

Re: [capnproto] How to get server-side implementation from client capability ?

2021-04-26 Thread Théophile B .
Thank you for your quick answer! The `Server` to `Client` "conversion" is done via the bootstrap capability, but I need the underlying `Server` back when calling capabilities returned by the bootstrap capability. Here is a simplified example where I (tried) to implement your advice: interface

Re: [capnproto] How to get server-side implementation from client capability ?

2021-04-26 Thread 'Kenton Varda' via Cap'n Proto
Hi Théophile, Take a look at CapabilityServerSet: https://github.com/capnproto/capnproto/blob/6b5bcc2c6e954bc6e167ac581eb628e5a462a469/c++/src/capnp/capability.h#L607-L633 When you convert your `Server` object to a `Client`, you need to do it using a CapabilityServerSet. Later, you can use the

[capnproto] How to get server-side implementation from client capability ?

2021-04-26 Thread Théophile B .
I'm not sure I'm usign the right terminology in my question, but I hope you will understand my problem with the following example. I'm developing a media library where the user can play/pause/stop different kinds of "pipelines" (source ~ camera, filter ~ processing, sink ~ display). Depending