[Issue 9816] Export is mostly broken
    d-bugmail at puremagic.com 
    d-bugmail at puremagic.com
       
    Sun Apr  7 21:32:12 PDT 2013
    
    
  
http://d.puremagic.com/issues/show_bug.cgi?id=9816
--- Comment #3 from Martin Nowak <code at dawg.eu> 2013-04-07 21:32:10 PDT ---
(In reply to comment #0)
> 1) Exporting a global variable leads to a linker error
The problem seems to be that export uses C like rules to distinguish
declarations and definitions. For declarations export means
__declspec(dllimport) and for definitions __declspec(dllexport).
export void foo();   // this treated as import
export void foo() {} // this treated as export
For global variables to be an export you need an initializer.
export __gshared int bar;     // this treated as import
export __gshared int bar = 0; // this treated as export
I don't think that rule makes sense as it's actually defining a variable and is
default initalized.
To mark a declaration-only extern should be used.
Furthermore this behavior always requires a header file with only declarations
for any importing module.
-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
    
    
More information about the Digitalmars-d-bugs
mailing list