Ah ok i see now. Thanks didnt realise that. --Phil On 13 December 2013 12:17, Jonathan Wakely <jwakely.gcc@xxxxxxxxx> 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.