This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: C++ name mangling
- From: Philip Herron <redbrain at gcc dot gnu dot org>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: GCC <gcc-help at gcc dot gnu dot org>
- Date: Fri, 13 Dec 2013 12:40:50 +0000
- Subject: Re: C++ name mangling
- Authentication-results: sourceware.org; auth=none
- References: <CAEvRberzHy4baff4+c=yt4i-HHXSG1u2cZNpDeL5en6V6+HsQw at mail dot gmail dot com> <CAH6eHdRyQDEFm73BvKZkVoj0aBBp-eHN7-=SO1nsNvT0p4C5Mw at mail dot gmail dot com>
Ah ok i see now. Thanks didnt realise that.
--Phil
On 13 December 2013 12:17, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> 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.