Request Assistance Calling D from C++: weird visibility issue inside struct and namespace
evilrat
evilrat666 at gmail.com
Wed Nov 8 07:30:34 UTC 2017
On Wednesday, 8 November 2017 at 06:34:27 UTC, Andrew Edwards
wrote:
>
> Modify example.cpp to:
>
> ======================
> // example.cpp
> #include "example.h"
> namespace SomeApi {}
> struct SomeStruct {}
> void call_cpp() {
> foo("do great things");
> return;
> }
> ======================
>
> Compile and link and you have D program calling, calling C++,
> which in turn calls D.
>
> My problem is that I've encountered an issue where this does
> not work: when the function is being called from a namespace or
> local scope in C++, the linker cannot find the definition. For
> example:
>
just using fully qualified name didn't make it?
void call_cpp() {
::foo("do great things"); // calling global foo
return;
}
>
> In a last-ditch effort, I placed all of these definitions into
> dexample.d and, it compiled, but still filed to linking:
>
Are you sure you put it in a namespace in C++ too?
otherwise there might be some name mangling incompatibility that
probably worth filling a bug report
More information about the Digitalmars-d-learn
mailing list