February 06, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=935

           Summary: Extern Global C Variables
           Product: D
           Version: 1.00
          Platform: PC
               URL: http://www.digitalmars.com/d/htomodule.html
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P3
         Component: www.digitalmars.com
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: torhu@yahoo.com


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.


-- 

March 26, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=935


torhu@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED




------- Comment #1 from torhu@yahoo.com  2007-03-26 11:24 -------
Fixed dmd 1.010.


--