freenode/#lisp - IRC Chatlog
Search
12:08:10
p_l
Shinmera: the name mangling algorithm is the *easy* part, since you can easily get GCC to spew out the mapping
12:08:56
p_l
vtable stuff gets hairy, because it's start as plain offset but then you need to take care of inheritance which is where it gets... weird
12:09:30
p_l
Shinmera: without GCC being available you have no guarantee that you'll get vtable layout, which means you're dead on arrival for C++ interfacing
12:09:53
p_l
anyway, C++ compiler involved in compiling the module you're linking with is necessary at the point of compiling the binding
12:10:28
p_l
the sole exception is Windows, which is used to heterogenous languages, so serious modules tend to have COM bindings, and those have common API
12:11:08
p_l
on AIX, you can compile C++ code with alternative interface which is afaik easier to interface with, but I don't know how it goes into code mixing
12:11:48
Shinmera
p_l: Hold on, why do you need GCC for the vtable layout? Surely the algorithm to compute it must be replicable
12:12:49
p_l
Shinmera: it's in the class of "you only need to implement a C++ compiler to interface with C++" kind of task
12:13:21
_death
not just vtable layout.. passing this, exceptions, limitations wrt template support.. etc. and of course each implementation may have its own ABI.. there was a good book (likely outdated by now with all these new standards) by Lippman
12:13:49
Shinmera
_death: If I remember correctly Clang and GCC are ABI compatible, so that part is not that big a deal
12:14:22
p_l
Shinmera: in theory, in practice you hit dependencies on their own implementation of stdc++
12:15:07
Shinmera
Oh yeah I remember trouble in Clasp building related to differing stdc++ implementations
12:15:33
p_l
"string" in one binary is not the same "string" in another binary depending on flags and libs
12:16:08
p_l
if the binary is compiled with full debug symbols, you can extract all kinds of data, including exception handlers
12:18:12
Shinmera
p_l: Will a library built without DWARF symbols still correlate with one built with so you could just parse out the definitions from a debug-enabled one?
12:23:39
Shinmera
The C++ exceptions part is fortunately one that can be ignored for a lot of libraries as they don't use it.
12:24:08
Shinmera
So even if there was "just" a vtable and name mangling compiler in CL you could get pretty far.
12:24:58
p_l
I'd still recommend DWARF parser for various reasons, including getting data on types etc.
12:33:54
Shinmera
Right, but even without exceptions there's a lot of stuff that needs to be replicated to get this going.
12:35:20
Shinmera
As p_l suggested, if the DWARF doesn't influence the produced binary, one aspect instead of replicating a compiler would be to parse out the DWARF info and use that to feed the information needed to call methods.
18:33:16
senecaty
Why does my isprime function always return nil? https://bpaste.net/show/1af47b67733a
18:59:38
aeth
What channel is it? Have they heard the "get a link via IRC bot that gives you a cookie, and that's the only way to paste" idea yet?