On 2014-04-28 20:50, Walter Bright via Digitalmars-d wrote:
On 4/28/2014 7:27 AM, Steven Schveighoffer wrote:
Consider this code:
module foo;
void func() {}
module bar;
extern(C) func();
module prog;
import foo;
import bar;
void main()
{
func(); // error
foo.func(); // ok
bar.func(); // ok, uses C binding (no name mangling)
}
In this case, even though the C function is not mangled or in any other
namespace, the module can be used for unambiguous calling.
Right.
module foo;
void func() {}
module bar;
extern(C++, foo) void func(); // foo::func in C++ land
module prog;
import foo;
import bar;
void main()
{
func(); // error
foo.func(); // ALSO error
No, not an error. Why would it be?
I believe Steven expects things to work this way:
module bar;
extern(C++, foo) void func();
module prog;
import bar;
void main()
{
foo.func(); // Calls bar.func (or is that bar.foo.func?)
}
--
Simen