Bug 18965 – private attribute does not make function private when extern(Windows) attribute is used

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2018-06-10T04:06:23Z
Last change time
2018-06-10T04:10:30Z
Keywords
link-failure
Assigned to
No Owner
Creator
ben stembridge

Comments

Comment #0 by ben.stembridge — 2018-06-10T04:06:23Z
If you have multiple functions with the same name in different modules that have the attribute extern(Windows) and are marked as private, it will cause a link error. This also happens with extern(C) linkage simple example with 2 modules: module other; extern(C) private void test() { } module main; extern(C) private void test() { } int main(string[] argv) { test(); return 0; } Error 1: Previous Definition Different : _test this is with dmd v2.080.0 windows x86
Comment #1 by alphaglosined — 2018-06-10T04:10:30Z
This is the correct behavior. extern(C) disables name mangling, extern(Windows) only differs for ABI and slightly with symbol naming. Without name mangling occuring they are the same symbol no matter what module it is in as defined by C compilers.