
Hi, Another quick question: Could you show how to invoke one specific method (can be any prototype) of the reflected class? Do you need to cast it into that real class type before you can invoke it? If so, then I think it doesn't satisfies what I mention that "the main program does not need to include any compile-time information of the reflected class, e.g. class header file". I do not see some clear example about this on your website, so I am wondering that. BR JinHua 2011/12/7 Matus Chochlik <chochlik@gmail.com>
On Wed, Dec 7, 2011 at 3:46 PM, jinhua luo <ljh.home.king@gmail.com> wrote:
Hi Matus,
If the reflection requires explicit symbol export/import, then it's not so flexible. For example, then you must place the Marco declaration within one and only one source file due to the ODR (One-Definition-Rule), but can not place it anywhere, e.g. the header file. However, the latter one is more reasonable and convenient, which makes your macro declaration just follows its class definition together.
I get it now, you were talking about exporting something from the library *per class*, yes that would be bad.
Mirror however requires only one function *per library* so ODR would not be a problem.
Another problem is if there exists many classes to be reflected, then your library should export an auxiliary symbol per class, which is not a good thing, I think, at least it will cause symbol naming collision. Last but not least, consider such scenario: the main program declares some classes, and the codes within loaded library try to reflect them and use them, i.e. the roles exchanges between them. Then it's not so possible to export some symbols in the executable on some platforms for access by the shared library (of course, on Linux, you can export symbols from executable via "-Wl,-E" linker options, but that's also bad development practise).
Matus
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost