-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++: types.inl make functions inline #1183
Conversation
PTAL @indirectlylit |
I believe this usage is incorrect — #define MCAP_IMPLEMENTATION // Define this in exactly one .cpp file |
@jtbandes @jhurliman That is not true. If I define it only in one TU where for example I include One solution would be to include both |
Can you explain more about why you think this design is bad? |
@jtbandes sorry, you are right, I should have given more context.
That said, the second point is just my opinion, feel free to ignore it, but this PR is still necessary otherwise I cannot compile my code. I hope what I wrote is clear, otherwise, I apologize, and please let me know I will be happy to engage more in this conversation. |
(just brainstorming here...) One idea that came up while we discussed #1065 was that the build system story would be simpler if we provided the entire implementation in just two files, e.g. |
closing in favor of #1190:
thanks again @filippobrizzi |
Changelog
Make functions defined in
types.inl
inline.Description
This is needed to avoid linker multiple definition errors.
How to reproduce:
reader.hpp
and onewriter.hpp
and both need to defineMCAP_IMPLEMENTATION
types.inl
is included by both compilation units and when linker creates the libraries, the functions fromtypes.inl
are defined twice.