On Sunday, 29 July 2018 at 07:45:35 UTC, Walter Bright wrote:
On 7/28/2018 9:23 PM, Manu wrote:
Don't troll me on this one, this is a very sensitive topic!
I could have a legit mental breakdown ;)
Here's another method:
------
extern (C++, ns) { int foo() { return 1; } }
mixin template X()
{
extern (C++, ns) { int bar() { return 2; } }
}
mixin X!() x;
-------
void main() {
pragma(msg, __traits(allMembers, ns));
foo;
bar;
}
$ dmd foo.d
tuple("foo")
foo.d(15): Error: undefined identifier bar
That method doesn't compile.
and another:
-----
extern (C++, ns) { int foo(); }
struct S
{
extern (C++, ns) { int bar(); }
}
----
void main() {
foo;
bar;
}
I changed them to be only declarations, since the goal is to call
existing C++ code, not to define it in a D file. `foo` works as
expected, but `bar`...
foo.o:foo.d:function _Dmain: error: undefined reference to
'S::ns::bar()'
collect2: error: ld returned 1 exit status
Neither method works.