[Python.NET] accessing .net dlls from python

Roman Yakovenko roman.yakovenko at gmail.com
Wed Mar 29 09:13:14 CEST 2006


On 3/29/06, Lalit DIGARI <lalit.digari at st.com> wrote:
> Hello,
> I have a dll named vp and I want to use it into python script dll has some
> exposed function for example fn1() I did following steps in python
>
>  import CLR
>  from CLR.System.Reflection import Assembly
>
>  my_dll_name =  Assembly.LoadWithPartialName('C:\\986tool\\vpci")
>  from CLR.System.Windows.Forms import Form
>  ##from CLR import TestWinForm
>
>  my_dll_name.fn1(1)

1. I could be wrong, but .NET does not allows use of global functions.
   fn1 should be static function of some class

2. my_dll_name is instance of class Assembly, you can use it in order
to call some
    function. ( Please re-check last statement, because I am not sure ).
    You should import it first.

>
>  But I  got two problems
>  1) my_dll_name is coming none after call to LoadWithPartialName(...)
>  2) the exposed function is name space TestWinForm as
>  using System;
>  using System.Drawing;
>  using System.Drawing.Imaging;
>  using System.Collections;
>  using System.ComponentModel;
>  using System.Windows.Forms;
>  using System.Data;
>  using System.Diagnostics ;
>  using System.Threading;
>  using System.Runtime.Serialization.Formatters.Binary ;
>  using System.IO ;
>          // ST Library
>  using STControlLibrary ;
>  using STImgPlatformLibrary ;
>
>
>  namespace TestWinForm
>  {
>         fn1()
>         {
>         }
>  }
>
>  How will I import it into python script so that I can use exposed function.

I think if you will resolve first issue and then write

my_dll_name =  Assembly.LoadWithPartialName('C:\\986tool\\vpci")
from CLR import TestWinForm
TestWinForm.GlobalFunctions.fn1(...)

it will do the job.

> If not clear then mail me back.
> Thanks n regard's
> Lalit

--
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/


More information about the PythonDotNet mailing list