A function defined with no implementation will make a link error:
// test.d
import std.windows.registry;
void main(){
Key k = Registry.localMachine;
}
Error 42: Symbol Undefined _D3std7windows8registry8Registry5_ctorMFZC3std7windows8registry8Registry
Comment #1 by wstring — 2007-03-26T09:34:45Z
Yet another test program:
// DMD 1.010
class Foo
{
static int bar() { return 2; }
private this();
}
void main()
{
int a = Foo.bar;
}
Comment #2 by fvbommel — 2007-03-26T10:14:09Z
(Note that both link errors are to default constructors)
This is caused by changes made to the implicitly generated ClassInfo data to support a new feature in v1.010[1].
The new static method Object.factory needs to be able to create an object based only on the ClassInfo (found by a lookup on the name passed). In order to be able to call the default constructor (if any), a pointer to it is added to the ClassInfo instance of the corresponding class.
The presence pointer requires that if the default constructor (again, if any) is defined in one of the object files or libraries linked in.
Regarding std.windows.registry.Registry, that class seems to exist only to provide a namespace to some static members, with the constructor declaration without definition in order to prevent instantiation.
The quickest way to get it to compile & link again would probably be to just make it a struct.
[1]: The changelog entry is "Added Object.factory(char[] classname) method to create class objects based on a string".
Comment #3 by bugzilla — 2007-03-30T14:59:47Z
If you declare a function, a definition has to be somewhere for it. I'll fix std.windows.registry.Registry so it does.