www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 935] New: Extern Global C Variables

reply d-bugmail puremagic.com writes:
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.


-- 
Feb 06 2007
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=935


torhu yahoo.com changed:

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





Fixed dmd 1.010.


-- 
Mar 26 2007