October 5th, 2012, 08:08 AM
Static library design advise needed
I'm currently setting up a project which will need to run on both win32 and wince. A lot of code will be common, but a substantial part will also be specific depending on the platform. Part of the common code is a communication stack. To keep things separated and manageable I though it would be a good idea to put the stack in a static library. The stack consists of a lot of classes that are interconnected but that don't really matter to the 'user' of the stack, so I would only offer those header files that the 'user' might need.
I suppose, so far so good, please correct me if I'm wrong, or if you'd have a better idea.
The tricky part is that the communication stack needs timers, and the implementation of those is platform specific. My current approach is to write the timer header file in the library project and export it together with the library. The implementation file should then be in the platform specific project.
- If I export the header files of only a couple of classes they will obviously show some implementation details that the 'user' of the library doesn't need to know about (everything that is private in those exported classes for example). How is this usualy hidden / done?
- Is my timer implementation a good idea? To me it feels somewhat strange but I can't seem to find a better solution. The code inside the library needs functionallity that is platform specific, but at the same time the library cannot contain anything platform specific.
I look forward for your ideas.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.