My idea for seamless interop to C++

Atila Neves atila.neves at gmail.com
Sat Nov 21 14:11:53 UTC 2020


On Thursday, 19 November 2020 at 17:29:54 UTC, jmh530 wrote:
> On Thursday, 19 November 2020 at 16:36:47 UTC, Atila Neves 
> wrote:
>> [snip]
>>
>> I'm using it in autowrap to translate the Python headers. 
>> Still some issues with macros though, that I had to translate 
>> by hand. But, then again, there's no other way to get around 
>> this and I'm out of ideas wrt to those particular macros.
>> [snip]
>
> Would using some like warp to process the macros first be 
> something you have considered?

Yes.

It didn't build. After I edited it to make it build, it didn't 
work.

In any case, I *am* using the C preprocessor on the macros. The 
problem is translating something like this from 
https://github.com/python/cpython/blob/0e62efc51e31c741b61604787aeab4936e6e50e4/Include/object.h#L84:

#define PyObject_HEAD_INIT(type)        \
     { _PyObject_EXTRA_INIT              \
     1, type },

I know how to translate that as a human, but I don't know how to 
write a program that does that for me and that works in the 
general case. Or even most cases.



More information about the Digitalmars-d mailing list