Thread overview | ||||||
---|---|---|---|---|---|---|
|
January 27, 2004 DMD 0.79 bug: Externs not working. | ||||
---|---|---|---|---|
| ||||
This requires three files. Here is "impl.d": module stub; class Class { this () { Method (); } void Method () { printf ("Hello, world!\n"); } } Here is "stub.d": module stub; class Class { this (); void Method (); } So "impl.d" contains the implementation while "stub.d" contains just the stub. Here is "user.d": import stub; class Inheritor : Class { this () { super (); } } void main () { new Inheritor; } The compilation process is like this: dmd -c impl.d dmd impl.obj stub.d user.d test.exe test.exe This causes an Access Violation right inside the Method call. It should and has historically worked. I don't know what version it was introduced into DMD, likely in the 0.7* series. |
January 27, 2004 Re: DMD 0.79 bug: Externs not working. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | Does it work if they are all compiled with separate dmd commands? |
January 27, 2004 Re: DMD 0.79 bug: Externs not working. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Burton Radons | Burton Radons wrote:
> This requires three files. Here is "impl.d":
>
> module stub;
>
> class Class
> {
> this () { Method (); }
> void Method () { printf ("Hello, world!\n"); }
> }
>
> Here is "stub.d":
>
> module stub;
>
> class Class
> {
> this ();
> void Method ();
> }
>
> So "impl.d" contains the implementation while "stub.d" contains just the stub. Here is "user.d":
>
> import stub;
>
> class Inheritor : Class
> {
> this ()
> {
> super ();
> }
> }
>
> void main ()
> {
> new Inheritor;
> }
>
> The compilation process is like this:
>
> dmd -c impl.d
> dmd impl.obj stub.d user.d test.exe
> test.exe
This process isn't quite right. They should be:
dmd -c impl.d
dmd impl.obj user.d test.exe
test.exe
"stub.d" was removed from the second line.
|
January 27, 2004 Re: DMD 0.79 bug: Externs not working. | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter | Walter wrote:
> Does it work if they are all compiled with separate dmd commands?
After the amendment, no (I don't think it would link with the first version of the commands). It looks like incorrect sub-classing is what's generating the problem as I can instantiate a Class from "user.d" directly without a problem (by adding "new Class;" to the beginning of "main()"); it's only once I try my own sub-class that it fails.
|
Copyright © 1999-2021 by the D Language Foundation