January 18, 2018 C++ function mangling Linux GCC | ||||
---|---|---|---|---|
| ||||
Am I missing something, or should extern(C++) just work for binding to gcc C++ on Linux. It works fine for primitives but fails for pointer type arguments. Extern "C" works fine. Does D know how to mangle function names based on pointer types? I have created matching types on both sides. Though I am using typedefs. Eg struct Foo_; typedef struct Foo_ Foo; and on D side struct Foo {} Could that be why? What the best way to see the types of library file function arguments for a libfoo.a file on Linux? Sorry for the dumb question. Thanks. Laeeth |
January 18, 2018 Re: C++ function mangling Linux GCC | ||||
---|---|---|---|---|
| ||||
Posted in reply to Laeeth Isharc | On Thursday, 18 January 2018 at 04:16:18 UTC, Laeeth Isharc wrote: > Am I missing something, or should extern(C++) just work for binding to gcc C++ on Linux. It works fine for primitives but fails for pointer type arguments. Extern "C" works fine. > > Does D know how to mangle function names based on pointer types? I have created matching types on both sides. > > Though I am using typedefs. Eg struct Foo_; typedef struct Foo_ Foo; and on D side struct Foo {} > > Could that be why? > Yes. C++'s typedefs and using are just like D's alias. The underlying type is used in the mangling. > What the best way to see the types of library file function arguments for a libfoo.a file on Linux? Sorry for the dumb question. > nm libfoo.a | c++filt ? or https://demangler.com |
Copyright © 1999-2021 by the D Language Foundation