Toni Barth
unread,Feb 10, 2018, 1:35:46 PM2/10/18Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to cython...@googlegroups.com
Hello all,
I've got the following situation:
I want to create a project which assembles a server for an already
existing project, but in Python (usually its in C), and attach this
server to another already existing Python project. Because the C-type
server brings important constants and functions, I want to use some of
its includes to utilize this server in Cython.
Most of the things I need are actually constants from a c-type file like
the following:
#ifndef __SRV_HEADER__
#define __SRV_HEADER__
#define CONST_1 1
#define CONST_2 2
...
#endif
The most easiest thing would be to include this header file in Cython
now, like with
cdef extern from "constants.h":
...
Is there an easy way to make all constants available in this C file now
available to any external Python program, like I include this Cython
module and type "constants_wrapper.CONST_1", without re-defining all
constants inside the Cython module manually? This would reduce
maintenance, because I don't need to adopt the whole Cython code
whenever the server devs change the content of one macro. I actually
know that most of those constants are ints or strings (or at least
multiple chars), so no shortener constants or functions, conditions or
actual macros are in there.
But I imagine this isn't possible at all, because the C compiler doesn't
know the underlying C type on runtime, because those are preprocessor
makros.
Anyway, thought I would simply ask here, maybe someone of knows more
about it.
Thanks for your help.
Best Regards.
Toni