<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16674" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2><SPAN class=026100616-31072008>Hi, 
</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=026100616-31072008></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=026100616-31072008>First let me say 
that I'm new to Iron Python, but at least I've read this in the FAQ.. 
:)</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=026100616-31072008></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=026100616-31072008>Q: How do I build 
and call into <B 
style="COLOR: black; BACKGROUND-COLOR: rgb(160,255,255)">PYD</B> 
libraries?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=026100616-31072008>A: <B 
style="COLOR: black; BACKGROUND-COLOR: rgb(255,255,102)">IronPython</B> does not 
support using PYDs built for CPython since they leverage implementation details 
of CPython.&nbsp; You can get a similar effect for new "<B 
style="COLOR: black; BACKGROUND-COLOR: rgb(160,255,255)">PYD</B>"s you would 
like to implement by writing them in C# or VB and building a DLL for 
.NET.</DIV></SPAN></FONT>
<DIV><FONT face=Arial size=2><SPAN 
class=026100616-31072008></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=026100616-31072008>That said, I've got 
some questions to see if what I'm doing is possible anyway.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=026100616-31072008></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=026100616-31072008>We've got a c 
library of which most of the code has also been written in Python. We want to 
create an editor using .net forms which we can use to edit some files, and to do 
that we need some data structures that exist in this library. 
</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=026100616-31072008></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=026100616-31072008>My current idea is 
to interface against the python library using IronPython, and then accessing the 
datastructures through that in C# (although if absolutely necessary, we could 
write the editor in IronPython too). The thing that is standing against me now 
is that one function that exists a small C dll. Since IronPython can't access 
this (unless this has changed since the FAQ was written?), I was thinking that 
maybe I can compile the dll using the /clr flag and thus get a .net assembly. 
Would I then be able to use the function?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=026100616-31072008></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=026100616-31072008>The Python code just 
tries to import it:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=026100616-31072008>import&nbsp;AvHash</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=026100616-31072008></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=026100616-31072008>And then use 
it..</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=026100616-31072008>def 
AdfHash(str):<BR>&nbsp;&nbsp;&nbsp; return 
AvHash.HashString(str)</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=026100616-31072008></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=026100616-31072008></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=026100616-31072008>At the import 
statement, this error is raised:</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=026100616-31072008>Traceback (most 
recent call last):<BR>&nbsp; File X:\ctg\libs\ADF\main\common\modeditor.ipy, 
line 20, in Initialize<BR>&nbsp; File , line 0, in __import__##4<BR>&nbsp; File 
X:\ctg\libs\ADF\main\common\AdfLib.py, line 1, in Initialize<BR>&nbsp; File , 
line 0, in __import__##4<BR>ImportError: No module named 
AvHash</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=026100616-31072008></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=026100616-31072008></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=026100616-31072008></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=026100616-31072008>Or is there some 
other solution? I've just started researching how to interface between 
C/C#/Python/IronPython so there may well be things I haven't heard 
of...</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=026100616-31072008>I hope I've made my 
problem clear, thanks for any responses. :)</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=026100616-31072008></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=026100616-31072008>/Anders</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=026100616-31072008></SPAN></FONT>&nbsp;</DIV></BODY></HTML>