Thread overview
[Issue 2106] New: export class doesn't affect, what is exported
May 14, 2008
d-bugmail
May 14, 2008
d-bugmail
May 14, 2008
d-bugmail
Jan 22, 2012
Walter Bright
Jan 22, 2012
Walter Bright
May 14, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2106

           Summary: export class doesn't affect, what is exported
           Product: D
           Version: 2.013
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Keywords: link-failure, spec
          Severity: major
          Priority: P3
         Component: DMD
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: the.yossarian@gmail.com


the export modifier on class doesn't work as excepted.

export class A { export public void function(); }
export class B : A { public void function2(); }

this code exports ONLY A.function(); ( i checked DLL with objdump )

the following throws undefined error when linking:

B b = new B();
A a = cast(A)b;

Error 42: Symbol Undefined _D4test1A1A7__ClassZ
.....


-- 

May 14, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2106


torhu@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |torhu@yahoo.com




------- Comment #1 from torhu@yahoo.com  2008-05-14 05:39 -------
(In reply to comment #0)
> the export modifier on class doesn't work as excepted.
> 
> export class A { export public void function(); }
> export class B : A { public void function2(); }
> 
> this code exports ONLY A.function(); ( i checked DLL with objdump )

I haven't tried getting classes inside DLLs to work myself.  But you should probably provide a complete, compilable, minimal test case.

> 
> the following throws undefined error when linking:
> 
> B b = new B();
> A a = cast(A)b;

Do you need both lines to trigger the error, isn't the first one enough?


-- 

May 14, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2106





------- Comment #2 from the.yossarian@gmail.com  2008-05-14 06:33 -------
ok, the first is enough.
test case:


--- dll.d ---
module dll;

export class A
{
        export void func() { }
}

--- test.d ---
import dll;

int main()
{
        A a = new A();
        return 0;
}

--- make.bat ---
dmd -ofdll.dll dll.d phobos.lib
dmd -oftest.exe test.d phobos.lib

dies with:
test.obj(test)
 Error 42: Symbol Undefined _D3dll1A7__ClassZ


-- 

January 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2106


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|spec                        |


--- Comment #3 from Walter Bright <bugzilla@digitalmars.com> 2012-01-22 01:40:12 PST ---
The problem is an export record isn't generated for the _ClassZ. It's a compiler bug, not a spec issue.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2106



--- Comment #4 from github-bugzilla@puremagic.com 2012-01-22 10:15:21 PST ---
Commit pushed to https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/34d31ba9e6267ac97cc8081ac4729076e4ca7bc5 fix Issue 2106 - export class doesn't affect, what is exported

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2106



--- Comment #5 from github-bugzilla@puremagic.com 2012-01-22 10:15:35 PST ---
Commit pushed to https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/2b627769522256f983b0fadca1e964752c6a2909 fix Issue 2106 - export class doesn't affect, what is exported

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 22, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2106


Walter Bright <bugzilla@digitalmars.com> changed:

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


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------