Date: Sun, 31 Aug 2025 23:40:00 -0700
"Much of this is in the header file(s) and not in the shared library
.so file(s)."
(Sorry if this is getting off topic for the C++ standard.)
It isn't all in there yet. But the E in ELF originally stood for
extensible. For example, the command line to add reflection data to an
.so would look like this:
objcopy --add-section .reflection=reflection_data --set-section-flags
.reflection=alloc,readonly input.elf output.elf
That can be done from inside the compiler too:
char __reflection_data[] __attribute__((section("reflection"))) = /* ... */;
It would be interesting to try to use C++26 reflection and consteval
to try to generate large amounts of reflection data this way.
The byte size of enums, classes and structs look like they would have
to be added at a bare minimum. I was shocked at how detailed the ABI
is otherwise.
On Sun, Aug 31, 2025 at 9:46 PM Paul Caprioli <paul_at_[hidden]> wrote:
>
> > My ideal world would involve a small open source C library that could
> > load the C++ symbol table from a .so/.dll and unpack it as needed.
> > Then the host language could talk to that C library and obtain all the
> > facilities it needed. That way an interpreter could simply populate
> > its module hierarchy with the contents of the .so automatically. I'd
> > love to have C++ namespaces, enums, classes, structs, operators and
> > functions just show up in interpreted languages without users doing
> > any work.
>
> Much of this is in the header file(s) and not in the shared library .so file(s).
>
>
.so file(s)."
(Sorry if this is getting off topic for the C++ standard.)
It isn't all in there yet. But the E in ELF originally stood for
extensible. For example, the command line to add reflection data to an
.so would look like this:
objcopy --add-section .reflection=reflection_data --set-section-flags
.reflection=alloc,readonly input.elf output.elf
That can be done from inside the compiler too:
char __reflection_data[] __attribute__((section("reflection"))) = /* ... */;
It would be interesting to try to use C++26 reflection and consteval
to try to generate large amounts of reflection data this way.
The byte size of enums, classes and structs look like they would have
to be added at a bare minimum. I was shocked at how detailed the ABI
is otherwise.
On Sun, Aug 31, 2025 at 9:46 PM Paul Caprioli <paul_at_[hidden]> wrote:
>
> > My ideal world would involve a small open source C library that could
> > load the C++ symbol table from a .so/.dll and unpack it as needed.
> > Then the host language could talk to that C library and obtain all the
> > facilities it needed. That way an interpreter could simply populate
> > its module hierarchy with the contents of the .so automatically. I'd
> > love to have C++ namespaces, enums, classes, structs, operators and
> > functions just show up in interpreted languages without users doing
> > any work.
>
> Much of this is in the header file(s) and not in the shared library .so file(s).
>
>
Received on 2025-09-01 06:40:13