celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pepijn Noltes (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CELIX-386) C++ Object with mutiple services not working
Date Mon, 21 Nov 2016 15:39:58 GMT
Pepijn Noltes created CELIX-386:

             Summary: C++ Object with mutiple services not working
                 Key: CELIX-386
                 URL: https://issues.apache.org/jira/browse/CELIX-386
             Project: Celix
          Issue Type: Bug
            Reporter: Pepijn Noltes
            Assignee: Pepijn Noltes

When providing multiple C++ services from a single object, the object first needs to be cast
before forwarding it as service to the C dep man. 

This is because in most (all) implementations casting can result in pointers with an offset.

For example If D is a class extending  B1 and B2, depending on the inheritance order, b1 or
b1 will have a different pointer value.

D  *d  = new D();
B1 *b1 = static_cast<B1*>(d);
B2 *b2 = static_cast<B2*>(d);

For more info see:

This message was sent by Atlassian JIRA

View raw message