You can do this but it is a bit of a fiddle. Say you have a python file fruit.py
APPLE = 0x80,
BANANA = 0x81,
CHERRY = 0x82,
DAMSON = 0x83,
In C/C++, you can declare it as
const int
#include "fruit.py"
notused = 0;
In python
from fruit import *
but there is a catch. The items declared as number, are sets or lists. To access the value, you need the first element so the values are APPLE[0], BANANA[0] etc or *APPLE, *BANANA. If the last item ends with a ; then it doesn't need an index
To add comments, use #undef
#undef rem // $Id$
#undef rem // $URL$
#undef rem // Common header file between python and C++
In C++, it will just undefine a macro. The rule is that you can undefine something even though it hasn't been defined, which is perfect for this. In python, it will just be a comment. The full example
include file (fruit.py)
#undef rem // $Id$
#undef rem // $URL$
#undef rem // Common header file between python and C++
APPLE = 0x80,
BANANA = 0x81,
CHERRY = 0x82,
DAMSON = 0x83,
python
from fruit import *
print(APPLE[0])
print(*BANANA)
C++
#include <iostream>
const int
#include "fruit.py"
NOTUSED = 0;
int main()
{
std::cout << APPLE << std::endl;
std::cout << BANANA << std::endl;
}