<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
    <title></title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Hi,<br>
    <br>
    Good point, i didn't think of this. However, when not loading the
    shared library, do you need the full reflection information? or
    could some metadata (custom attributes) and perhaps a list of class
    be enough (in fact this is already available from the symbole list)?
    The main drawbacks I can see for your approach is that:<br>
    * executable format dependent data loader<br>
    * you must generate the data yourself (what about member offset,
    function adress and interaction with relocation,...)<br>
    * some functions refered by your data could be pruned by the linker
    because unused or inlined,, but still have reflection reference<br>
    <br>
    However, i do not know what your use case is. Mine would be things
    like script binding, generic property exploreur, (de)serialisation,
    data dumping/printing for debug... In all these case the dll would
    be loaded anyways. But since I do not have times to work on it, do
    wathever you want. I was just thinking your way needed more work.<br>
    <br>
    regards,<br>
    Cédric<br>
    <br>
    On 13/12/2010 21:58, Stuart Carnie wrote:
    <blockquote
      cite="mid:AANLkTikua1uu4jRFfEhk97o0tRP1=VVFNQabu58MmtMP@mail.gmail.com"
      type="cite"><font face="tahoma,sans-serif">
        <div><font face="tahoma,sans-serif">Cédric,</font></div>
        <div><font face="tahoma,sans-serif"><br>
          </font></div>
        <div><font face="tahoma,sans-serif">Your suggestion is quite
            reasonable, however in your scenario you must load the
            shared object / library into memory and execute code in
            order to enumerate the metadata.  You will incur all the
            performance penalties for loading shared libraries for
            executable purposes, such as rebasing, etc.  A particularly
            useful scenario for reflection is to scan a directory of
            libraries and determine available features or plugins, that
            would be quite costly if they all had to be dynamically
            loaded.  It would be fairly easy to abstract the reading of
            the metadata from a specific data section.</font></div>
        <div><font face="tahoma,sans-serif"><br>
          </font></div>
        <div><font face="tahoma,sans-serif">My scenario still does not
            require changes to LLVM or the C++ language, only changes to
            Clang to generate the metadata.</font></div>
        <div><font face="tahoma,sans-serif"><br>
          </font></div>
        <div><font face="tahoma,sans-serif">Good discussion, either way,
            as it would make it easy to generate scriptable C++
            libraries in a non-invasive way.</font></div>
        <div><font face="tahoma,sans-serif"><br>
          </font></div>
        <div><font face="tahoma,sans-serif">Cheers,</font></div>
        <div><font face="tahoma,sans-serif"><br>
            Stu</font></div>
        <br clear="all">
      </font><span style="font-family: arial,sans-serif; font-size:
        13px; border-collapse: collapse; color: rgb(80, 0, 80);"><strong><span
            style="color: rgb(153, 204, 255);">Stuart Carnie, CTO</span></strong><br>
        <span style="color: rgb(255, 102, 0);"><strong><a
              moz-do-not-send="true" href="http://manomio.com/"
              style="color: rgb(255, 102, 0);" target="_blank">manomio</a> |
            in retro we trust!</strong></span></span><br>
      <br>
      <br>
      <div class="gmail_quote">On Mon, Dec 13, 2010 at 12:12 PM, Cédric
        Venet <span dir="ltr"><<a moz-do-not-send="true"
            href="mailto:cedric.venet@laposte.net">cedric.venet@laposte.net</a>></span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;">
          <br>
          <br>
          Le 13/12/2010 19:37, Stuart Carnie a écrit :<br>
          <div class="im">> Static reflection seems to be very
            limited.  Reflection is a powerful<br>
            > mechanism for being able to analyse a 3rd party
            executable or dynamic<br>
            > library and interact with it at runtime, dynamically
            invoking APIs.<br>
            <br>
          </div>
          Static reflection is useful, but I agree it is a (completly)
          different<br>
          problem. However, your proposal still seems quite complex and
          invasive.<br>
          Why not juste store the reflection data in C++ structures and
          expose<br>
          them by the mean of global const static object?<br>
          <br>
          something like:<br>
          <br>
          **** input<br>
          <div class="im">struct Foo<br>
            {<br>
              void f();<br>
              int a;<br>
            };<br>
            <br>
          </div>
          **** generated by clang<br>
          // Contain functions for decoding the reflexion information<br>
          struct reflection::class_data_base  {<br>
            void EnumMembers(Fct callback);<br>
            int GetValue(const char* name);<br>
            void Call(const char* name);<br>
            //...<br>
          };<br>
          // for name mangling<br>
          struct
          reflection::class_data<Foo>:reflection::class_data_base
          {<br>
            static const int num_members=2;<br>
            // obviously pseudo code :)<br>
            static const datatable=[ "f", &f, "a", &a ... ];<br>
          };<br>
          <br>
          <br>
          This would allow to not modify llvm and C++ code could be
          generated by<br>
          clang for other compiler. Clang does not need to generate the
          reflexion<br>
          code, it could create an ast or codegen it directly.<br>
          <br>
          This would also make it portable, no need to access metadata
          in an<br>
          executable...<br>
          <br>
          Hope this makes sense.<br>
          Anyways just my two cents. Good luck on your project, it is
          really<br>
          interesting and useful (especially with the rise of fast
          scripting<br>
          language).<br>
          <br>
          regards,<br>
          <font color="#888888">Cédric<br>
          </font>
          <div>
            <div class="h5">_______________________________________________<br>
              cfe-dev mailing list<br>
              <a moz-do-not-send="true"
                href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
              <a moz-do-not-send="true"
                href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev"
                target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
            </div>
          </div>
        </blockquote>
      </div>
      <br>
    </blockquote>
    <br>
  </body>
</html>