How to use a C# dll in IronPython

后端 未结 6 789
轻奢々
轻奢々 2020-12-03 05:18

I have created a dll using C#. How do use the dll in IronPython. I have tried to add the dll using clr.AddReference(\"yxz.dll\"). But it fails. I have tried pla

6条回答
  •  孤城傲影
    2020-12-03 06:09

    It's better to use clr.AddReferenceToFile(filename) , because it takes a relative path.

    import clr 
    clr.AddReferenceToFile("xxx.dll")
    

    Then you can import the classes by import as usual:

    import xxx
    

    or

    from xxx import *
    

    I recommend you to check out this book , it's very helpful. https://play.google.com/store/apps/details?id=com.gavin.gbook

提交回复
热议问题