Return-Path: X-Original-To: apmail-incubator-celix-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-celix-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1C9EE9D63 for ; Thu, 26 Jan 2012 12:37:06 +0000 (UTC) Received: (qmail 58331 invoked by uid 500); 26 Jan 2012 12:37:05 -0000 Delivered-To: apmail-incubator-celix-dev-archive@incubator.apache.org Received: (qmail 58303 invoked by uid 500); 26 Jan 2012 12:37:05 -0000 Mailing-List: contact celix-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: celix-dev@incubator.apache.org Delivered-To: mailing list celix-dev@incubator.apache.org Received: (qmail 58295 invoked by uid 99); 26 Jan 2012 12:37:05 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jan 2012 12:37:05 +0000 X-ASF-Spam-Status: No, hits=1.0 required=5.0 tests=RCVD_IN_DNSWL_NONE,SPF_SOFTFAIL X-Spam-Check-By: apache.org Received-SPF: softfail (nike.apache.org: transitioning domain of marcel.offermans@luminis.nl does not designate 194.109.24.30 as permitted sender) Received: from [194.109.24.30] (HELO smtp-vbr10.xs4all.nl) (194.109.24.30) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 26 Jan 2012 12:36:56 +0000 Received: from supernova.fritz.box (planetmarrs.xs4all.nl [82.95.193.148]) (authenticated bits=0) by smtp-vbr10.xs4all.nl (8.13.8/8.13.8) with ESMTP id q0QCaYhQ016310 for ; Thu, 26 Jan 2012 13:36:35 +0100 (CET) (envelope-from marcel.offermans@luminis.nl) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) Subject: Re: Celix services and struct inheritance From: Marcel Offermans In-Reply-To: Date: Thu, 26 Jan 2012 13:36:34 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <23466B3E-C86A-48CA-B08B-34057ECCDF34@luminis.nl> References: To: X-Mailer: Apple Mail (2.1084) X-Virus-Scanned: by XS4ALL Virus Scanner X-Virus-Checked: Checked by ClamAV on apache.org On Jan 26, 2012, at 13:19 PM, Pepijn Noltes wrote: > I have a problem relating to Celix services and inheritance. The > problem is than under Java it's quite normal to cast retrieved > services to a derived type, but under C this is not as easy and not > safe (no RTTI ->no instanceof). Even though in Java you can (try to) cast a class or interface to a = derived type, when you lookup a service in the OSGi service registry, it = is extremely unwise to assume anything other than the fact that you just = got an instance that implements exactly the interface you looked up. > [...] But I am not really happy with this solution. It leans to much = on the > assumption service pointer can be cast to derived type and there is no > way to check if this is correct. Agreed. > In my opinion there are 2 alternative to this: > 1) > Register multiple services. But than means I am left with the > challenge how to find the related service. In Java, you already have the option of registering an instance under = multiple service names. Would doing the same for C solve your issue? Greetings, Marcel