How might I write a single header file that defines an interface and use a separate source files to write platform-specific code?
For example:
video.h
video_windows.c
video_linux.c
video_osx.c
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In your question you have all header files while you are talking about a shared header between source files.
In any case you just provide a common
.hfile and have 3 differentYou then include to your makefile (or whatever you use) the correct one according to the platform.
If you want to separate code in header files or in source files directly you can easily use some predefined macros, see here.