Hi,

Please excuse for a longish mail, but i am putting the complete question.

I have a class A in module testD as follows

module testD;
import std.stdio;
public class A {
        public this() {
                writeln("const");
        }
        public void a(string l, int k) {
                writeln("Hello B.a", l, k);
        }
}

I have another file which uses this class as follows:

module user;
import std.stdio;

int main() {
        Object obj = Object.factory("testD.A");
        if(obj is null)
                writeln("null object");
        else
                writeln("object created");
        return 0;
}

When i compile the class A as "dmd -c -of testD testD.d" and the second file as 
"dmd user.d testD",
the example works fine and the object gets created.

But When i compile the class A as "dmd -c -lib testD.d" and the second file as 
"dmd user.d testD.a",
the example gives me a null object.

The Object.factory method does not seem to work if my class has been compiled 
as a static library.
Can you please let me know how to solve this. I have tried replacing public 
with export for class
testD, but that does not help.

Thanks for reading the mail.
Mandeep

Reply via email to