Using Custom DLL with IronPython / Scripts

Using Custom DLL with IronPython

This example here assumed that you have class written in VB/C# with the following namespace Liverpool.Soccer.

It has a static class called Torrest.Hello();

First set the lookup path for Pyton

1.import sys

2.sys.path.append("c:\\love\\Liverpool.soccer\\Liverpool.Soccer\\bin\\Debug")

3.import clr

4.clr.AddReferenceToFile("Liverpool.Soccer.dll");

5.import Liverpool.Soccer

Finally invoke your method by calling :-

6.Liverpool.Soccer.Torrest.Hello();

That's it.


Alternatively .... you can save this into a file call clib.py.

import sys
sys.path.append("c:\\love\\Liverpool.soccer\\Liverpool.Soccer\\bin\\Debug")
import clr
clr.AddReferenceToFile("Liverpool.Soccer.dll");
import Liverpool.Soccer
Liverpool.Soccer.Torrest.Hello();

Then execute it using ipy clib.py

Comments

Popular posts from this blog

OpenCover code coverage for .Net Core

Android Programmatically apply style to your view