@sayol, I'm the creator of that library. In order to export the class, you need 
to put the export marker with of RootObj at the end. This is due to some 
limitations in the Nim parser.

You also need the export markers on all methods/properties you want to be 
exported, just as @mratsim suggested.

I've modified your code to work with the latest Nim devel branch.
    
    
    #test_class.nim
    import extensions/oop
    
    class MyClass* of RootObj:
      var
        value*: int
      
      method init*(value: int) {.base.} =
        self.value = value
      
      method print*() {.base.} =
        echo self.value
    
    
    Run
    
    
    # main.nim
    from test_class import MyClass, print # need to import print here in order 
for the compiler to see it.
                                         # Otherwise, `import test_class` can 
be used to import all.
    
    var m: MyClass
    
    m = MyClass(value: 111)
    m.print()
    
    
    Run

Reply via email to