I am writing an app that is one part PHP and one part C. The two pieces will talk via sockets. As part of the protocol for the IPC, the app will rely on a “message type” byte. For example, if the first byte of the data block is 1, then the rest means something like Show System Info, etc.
In the C header file, I could define these message types like…
#define GET_SYSTEM_INFO 0x1
#define SET_SECURITY_LEVEL 0x2
etc
I would really like it if I could define these values in one file that is shared between the php portion and the c app. That way, they are working off a common set of config. It doesn’t have to be a header file, but i was wondering if there was some easy mechanism for both technologies to parse a common file.
Thanks for any suggestions.
What I would suggest, since you really want to do it for development and the end user will not need to access the internals of your protocol, is to parse a php file for example and create an include for C, or the opposite through your build script.