January 18, 2018
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
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