On Wednesday, May 02, 2012 11:03:37 AM Stefan Karpinski wrote:
> Do you know how Python calls C++? Since there's no C++ ABI
I was going to release this after much more serious testing, but why not just
jump the gun?
https://github.com/timholy/julia/blob/cpp/extras/cpp.jl
Personally, I don't see what's so awful about the C++ name mangling, aside
from the (rather big) fact that it's not standardized across compilers. C does
the same thing explicitly, i.e., we have floorf and floorl, etc. In C++ they'd
all be called floor, and then the compiler attaches extra characters to signal
the data types. But likely I don't appreciate the more troublesome aspects.
Someone would have to add in the name mangling table from other compilers, but
this is a nice reference:
http://www.agner.org/optimize/calling_conventions.pdf
As you can see, currently that should involve changing just two lines. For a
general solution, we'd need a scheme for figuring out which platform we're on.
There's still a lot missing, of course, like namespaces, virtual table layout,
etc. Re virtual table layout, since we can't currently ccall with structures,
it's not currently an issue. Though given Patrick's progress, it looks like it
could become one fairly soon!
--Tim