www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 2106] New: export class doesn't affect, what is exported

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


-- 
May 14 2008