This part isn't so bad - you'd just need to have a library which has all the same exports as Python that the C extension would call into instead of calling into the real Python. The wrapper library would then translate the C Python extension interface into calls into the IronPython runtime.
I think the real difficult part is that the C extensions don't always do operations via function calls to opaque blocks of data. Instead the libraries directly expose memory (e.g. the ref count field which is a macro) and the C extensions directly access that memory. So somehow that needs to be dealt with. One option would be to re-build the C extension against a new version of the header files that don't directly access memory (if it's only ref counting that might be real easy). Another option might be to use SEH & only hand out memory to the C extension that is read-only and then handle & continue the exceptions on writes. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Slide Sent: Monday, January 08, 2007 7:10 AM To: Discussion of IronPython Subject: Re: [IronPython] C Extensions I think the main issue with C extensions, is that they call back into the Python runtime library to register themselves, this would have to be intercepted by FePy in order for things to work correctly. slide On 1/8/07, dwelden <[EMAIL PROTECTED]> wrote: > SWIG can generate wrappers for C#. Perhaps that could form the > foundation for C module wrapping for FePy. > > On Jan 6, 7:58 pm, slide <[EMAIL PROTECTED]> wrote: > > As it has come up on the list several times, I was wondering if anyone > > had given any thought to implementing an interface such that C > > extensions could be used with FePy I know that FePy would have to > > implement and export (and do some other magic) the C registration > > functions, etc that the C extensions call. On Windows specifically, I > > can envision that the import table of the C extension would need to be > > modified to not rely on libpython, as well as redirecting the addresses > > of the imported Python API functions to FePy functions which do the same > > thing, seems somewhat complicated to me. Is it even feasible to do? > > > > slide > > > > _______________________________________________ > > users mailing list > > [EMAIL PROTECTED]://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > _______________________________________________ > users mailing list > users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > _______________________________________________ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com _______________________________________________ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com