Bug 1080 – Failed to link to std.windows.registry

Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
phobos
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2007-03-26T09:30:00Z
Last change time
2014-02-16T15:24:00Z
Keywords
link-failure
Assigned to
bugzilla
Creator
wstring

Comments

Comment #0 by wstring — 2007-03-26T09:30:02Z
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.
Comment #4 by bugzilla — 2007-04-11T22:00:54Z
Fixed dmd 1.011