I am having a technical problem with the new C # program that I am developing. In this project, I need to establish a connection with another Windows-based system on a TCP / IP network. Al software written on another system is running in C, and any other future development will also be done in C / C ++. All protocols are run in C by another engineer, and protocol definitions are done using a C typedef struct that defines all the variables, and using memcpy to retrieve / place data packets that are great for C. All my protocols come in C header files with all typesdef and struct types in them, and any changes made to the protocol in the future will be performed in a similar way.
My question is, is there a way to use them in C #?
I tried to compile them as a class into a DLL, but did not work, because C # can only use managed C dlls. If I try to compile C as a managed class, itβs just a mess because there are a lot of arrays in the protocol, and since the C code must match the set of mill specifications, many of the variables were typedef. Now I can go and redo all the structures on C #, but it will take a lot of time, and I will have to redo it every time a change or something added to the protocol occurs. Not to mention the danger of slipping errors every time I do this.
How this works with my C projects is that another engineer will just provide me with updated header files.
So, is there a way to use these header files directly in C # or an automatic conversion that I can do every time the protocol is updated? Well, I basically need to use this header file to extract data from a data stream coming through a TCP / IP connection (without the possibility of using memcpy).
The reason for using C # is because I use a lot of graphics in WPF, and Visual C ++ does not support WPF
Any help or suggestions would be greatly appreciated?
gerharddvs
source share