[IronPython] Announcement: Project to get some CPython C extensions running under IronPython

Tony Djordjevski tony at v-sim.com
Thu Oct 18 19:36:08 CEST 2007



Paolo Molaro wrote:
> On 10/17/07 Tony Djordjevski wrote:
>>> You do need to write C code as the API is a C API. I didn't list in the
>>> last mail because the C implementation of these functions is not a
>>> difference between the C# impl and the C++ impl of the rest of the code.
>>> The dllimport declarations I mentioned above would pinvoke to these C
>>> functions.
>> Those C functions you speak about will need to execute managed code.
>>
>> So, either way, what needs to be done is to allow "Reverse P/Invoke" or 
>> some form of DllExport.  Assuming this project is successful, native 
>> C/C++ will have to, at some point, execute managed code.
>>
>> There are only two ways that I know of that you can accomplish this in .NET:
>> 1. C++ Interop
>> 2. Modifying a compiled assembly
> 
> or 3, the easiest of all: using function pointers in the C code which
> the runtimes will generate automatically when passing a delegate
> to a p/invoked method.
> Besides being trivial compared to both 1 and 2, it works on Mono and it
> works on the MS CLR.
> Happy hacking!
> 
> lupus
> 

You're right.  I actually forgot about that one, hence my post.

Best Regards,
Tony



More information about the Ironpython-users mailing list