How to share C code between different platforms

71 views Asked by At

I am writing a pair of C programs to communicate between a Linux host and a Raspberry Pi, via sockets. There is some shared code and data; and some general-purpose sockets functions.

My first thought was to put the common functions in an archive library. That seems like overkill as the library would have to be compiled on both platforms. The next idea is to use a common file that would be #include'ed in both programs.

I know that it has always been frowned upon to put code in header files, so I am asking for any other ideas.

I only have a few hundred lines of code. It is a small hobby project for my own personal use, so nothing too heavyweight. Ease of maintenance, free of cost and future expandability are my main aims.

0

There are 0 answers