Best way to make C ++ software package and C # package access the same enum / constant ints

I am developing a software package that transmits messages. I currently have a header file containing the definition of post IDs. A colleague of mine is building a software tool in C # and needs access to these ids. What is the best way for our software to access these IDs?

More: He and I have no control over which language we use. He wants to make 2 copies of the same list. I always hesitate to make copies of the same code. (There will be many post IDs). Is there an easy way for both of these tools to access the same ID?

+3


source to share


2 answers


C ++ / CLI is your friend. I had the same scenario in one of my projects and found C ++ / CLI very helpful in this regard. My design was based on 3 layers:

C#
_______
C++/CLI
_______
C++

      



This way I could easily reuse my C ++ definitions without any duplicates

+2


source


You can specify identifiers in some declarative, trivial parsing grammar, and create your (automatic) build process from C # and C ++ source files. This way you have one source.



+2


source







All Articles