Create object from a library's Class returns Null

dangbinghoo dangbinghoo at gmail.com
Tue May 28 09:25:51 UTC 2019


hi there,

I have a set of DB entity class in a library and creating Object 
from another project which linked with the library returns Null.

I don't know what's wrong there.

the source is like this:

   a. I have a library with such a structure:
      gwlib/source/gwlib/entity/nsconf.d

     with content:

    --------------
     module gwlib.entity.nsconf;

     class NSconf
     {
         String name;
         ...
     }
    --------------

   b. I use this gwlib library in another project named testobj

      testobj/source/app.d :

     --------------
      import gwlib.entity.nsconf;

      void main()
      {
           writeln(Object.factory("gwlib.entity.nsconf.NSConf"));
      }
     --------------

      this print out `null`.

     dub file cofig is :
     -----------------
     "dependencies": {
		"gwlib": {"path":"../gwlib"}
     },
     -----------------

And I just tested with DMD and LDC2, the result is a little 
different, but all the two is returning a null object.

I don't know what's the reason.


Could someone help with this? Thanks!

   > I posted the dub version of the whole project on github:
     https://github.com/dangbinghoo/DObjectCreatTest
     one can just clone and reproduce the result.


-------
binghoo dang



More information about the Digitalmars-d-learn mailing list