Carl Witty wrote:
> On Thu, Aug 5, 2010 at 12:08 AM, Dag Sverre Seljebotn
> <[email protected]> wrote:
>   
>> On 08/05/2010 06:01 AM, Carl Witty wrote:
>>     
>>> I'm starting by essentially duplicating all of the generate_* methods
>>> into generate_dotnet_* methods, and modifying the duplicated methods
>>> to generate C++/CLI code.  My hope is that once I have a working
>>>
>>>       
>> Ah, this is very interesting -- when I've spoken with Enthought on the
>> matter we've largely ignored C++ for this and were talking about a C#
>> backend.
>>     
>
> I convinced the Enthought people that a C++/CLI backend was the best
> first step.  For a variety of reasons (mostly the fact that Cython's
> "extern from" describes the API, not the ABI, but also catching C++
> exceptions and turning them into Python exceptions) a C# backend would
> have to generate C or C++ wrappers for every operation on "extern
> from" values/types (function call, global variable read, global
> variable write, struct member read, struct member write, ...).  On the
> other hand, a C++/CLI backend can handle "extern from" in exactly the
> same way that the current C/C++ backend does.
>   
Ahh. Yes, that makes everything much nicer indeed. (I know very little 
about .NET, but I did manage to identify the "extern from" as the 
critical non-obvious piece to get Cython running...)

My reason for asking is that I looked forward to all the goodies of C#: 
The "dynamic" type with call-site caching when calling methods on pure 
Python objects, and (down the line) builtin support for closures. (I 
don't know how much of that is available in C++/CLI?)

Speaking, hypothetically, about a C# backend, my two preferred options 
for _C_ code are either a) require that an ABI is specified in the 
Cython code (which is backwards-compatible with specifying API), or b) a 
two-stage build to generate C source that generates C# source (using 
offsetof and sizeof etc. to get hold of the ABI).

Interfacing with C++ would need run-time wrappers, anyway, though...

Anyway, I'm really glad that you have such a good handle on these 
things; I'm really happy Enthought asked you about this, they couldn't 
have got someone better for the task.

Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to