Bug 935 – Extern Global C Variables

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dlang.org
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-02-06T11:04:00Z
Last change time
2014-02-15T13:12:54Z
Assigned to
bugzilla
Creator
torhu

Comments

Comment #0 by torhu — 2007-02-06T11:04:03Z
Under the heading 'Extern Global C Variables', it's explained that you need to create an extra module that is not linked with, in order to avoid a multiple definition error. But given a C header file: struct Foo { }; struct Foo bar; It's enought just to have a single module, like this: struct Foo { } extern extern (C) Foo bar; The first 'extern' makes bar a pure declaration, and the definition in the C library will be used. Tested with dmd 1.0 and 1.004.
Comment #1 by torhu — 2007-03-26T11:24:43Z
Fixed dmd 1.010.