extern(C) symbol conflicts
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Fri Jan 30 05:14:38 PST 2015
On 1/29/15 4:38 PM, Walter Bright wrote:
> On 1/29/2015 5:43 AM, Steven Schveighoffer wrote:
>> Is there a good reason to do it the current way besides
>> "that's what C++ does"?
>
> My reason for saying "that's what C++ does" is that in 30 years I've
> never heard anyone bring it up as a problem. So while we could go about
> diagnosing such errors, I regard it as a very low priority.
>
Maybe because that's not how it works in C++ (thought I would test):
lib1.h:
namespace x
{
extern "C" {
void cfunction();
}
}
lib2.h:
namespace y
{
extern "C" {
void cfunction();
}
}
main.cpp:
#include "lib1.h"
#include "lib2.h"
using namespace x;
using namespace y;
int main()
{
x::cfunction(); // OK
y::cfunction(); // OK
cfunction(); // OK
return 0;
}
-Steve
More information about the Digitalmars-d
mailing list