[Python.NET] Using Third Party C# Libraries

angel ignacio colmenares laguado angel.ignacio.colmenares at gmail.com
Sun Feb 25 17:25:01 CET 2007


for Python.NET support for .NET 2.0:

1. Download de latest source from
http://pythonnet.svn.sourceforge.net/viewvc/pythonnet/trunk/

(you can use Tortoise SVN in win*)

2. change in  importhook.cs :

line 25
static *Clr*Module clr;   with	static *clr*Module clr;

line 50
clr = new *Clr*Module("clr");     with 	    clr = new *clr*Module();

line 51

Runtime.PyDict_SetItemString(dict, "clr", *clr*.pyHandle);
with
Runtime.PyDict_SetItemString(dict, "clr", *root*.pyHandle);


line 111:
Runtime.Incref(*clr*.pyHandle);
with
Runtime.Incref(*root*.pyHandle);


line 112:
return *clr*.pyHandle;
with
return *root*.pyHandle;


3. Change makefile with this:

ILDASM=ildasm.exe
ILASM=/c/WINDOWS/Microsoft.NET/Framework/v2.0.50727/ilasm.exe
CSC=/c/WINDOWS/Microsoft.NET/Framework/v2.0.50727/csc.exe

all: python.exe

python.exe: Python.Runtime.dll
	cd src; cd console; \
	$(CSC) -nologo -target:exe -out:../../python.exe \
        -reference:../../Python.Runtime.dll -recurse:*.cs
	cd ..; cd ..;


Python.Runtime.dll:clr.dll
	cd src; cd runtime; \
	$(CSC) -nologo -unsafe -target:library -out:../../Python.Runtime.dll \
       -reference:clr.dll \
*       -recurse:*.cs
	cd ..; cd ..;

*clr.dll:
	$(ILASM) -nologo -dll -quiet -output=clr.dll \
	./src/runtime/clrmodule.il;



4. using Mingw32 (msys) execute:
makefile


you get :Python.Runtime.dll, clr.dll and pyton.exe ready for net 2.0


5. put Python.Runtime.dll and crl.dll in your python24 directory.


6. you can get ready binaries (Python.Runtime.dll, clr.dll and
pyton.exe) for Net 2.0  from :
 http://angel.ignacio.colmenares.googlepages.com/pythonnet

7. Some screenshots in :
http://angel.ignacio.colmenares.googlepages.com/pythonnet*
 <http://angel.ignacio.colmenares.googlepages.com/pythonnet>*

angel ignacio colmenares laguado
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/pythondotnet/attachments/20070225/a5da2210/attachment.html 


More information about the PythonDotNet mailing list