https://issues.dlang.org/show_bug.cgi?id=19700
--- Comment #1 from Jacob Carlborg <[email protected]> --- Here's the problem. What's happening in your example is that the whole NSString class is overwritten. When a class is referenced and only declared, a specific symbol is outputted by the compiler. When the class is defined as well additional symbols are outputted as well. Since these symbols are located in the object file the linker won't search for them in external libraries. It's the same thing as doing: extern (C) void* malloc(size_t size) { return null; } I currently don't have a good way to determine if a class is externally defined or not. The current implementation will assume that it is externally defined if none of the methods have a body. This is not an ideal solution, it causes this problem, as you have noticed. It's also not possible to have an empty subclass. I think the original implementation required to use `extern (Objective-C)` on externally defined classes and not use it on internally defined classes. That requires that all classes defined in D inherit from an externally defined class. This is true most of the time, the Objective-C compiler will warn if you don't inherit from a class. In Objective-C this is easily handled by having two separate keywords for declarations and definitions: @interface Foo // declaration of a class named Foo @end @implementation Foo // definition of Foo @end I'll try to figure out how this is handled in Swift. --
