Re: C++ name mangling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 13 December 2013 12:04, Philip Herron wrote:
>
> I know you can do SET_DECL_ASSEMBLER_NAME on an fndecl. But not sure
> how the mangling is done for C++ is there a convention to the c++
> standard or is it compiler specific i imagine it must be some
> standard.

GCC follows the C++ ABI for Itanium, as specified at
http://www.codesourcery.com/cxx-abi/


> And where is it implemented in Rust you can do:
>
> #[link_args = "-lreadline"]
> extern {
>     fn readline (p: *std::libc::c_char) -> * std::libc::c_char;
> }
>
> I would like to be able to do something like:
>
> extern "c++" {
> }
>
> So then any rust program can call into c++ wrappers maybe? Maybe
> leaving out templates and classes. Maybe i can do something like
> SET_DECL_ASSEMBLER_NAME (cpp_mangle ("test"))

What do you expect "test" to mean?  To mangle a function name you have
to say the function signature, not just the name, that's the point of
mangling. "_Z4testi" is a function with one parameter of type int.
"test" is just a variable called "test" not a function.




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux