Where to use "new" in a DLL?

Gilles G. schaouette at free.fr
Mon Jun 25 02:22:43 PDT 2007


Hello,
I am new to system programmation so, please, excuse my ignorance...
I am writing a DLL and I would like to have a class that would be a DllManager. Then, I export some of the functions using extern(Windows) and a .def file.
The problem is that I don't now where I can create a new DllManager.
For example:
class DllManager
{
public:
        this(){}
        ~this(){}
        void sayHello(){writefln("Hello!");}
}
DllManager manager = new DllManager();
extern(Windows) void DllSayHello(){manager.sayHello();}

With this code I get the error:
Error: non-constant expression new DllManager

Thank you for your help.
--
Gilles


More information about the Digitalmars-d-learn mailing list