Skip to content
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

Optional std::filesystem #191

Open
Nekto89 opened this issue Jul 21, 2022 · 2 comments
Open

Optional std::filesystem #191

Nekto89 opened this issue Jul 21, 2022 · 2 comments

Comments

@Nekto89
Copy link

Nekto89 commented Jul 21, 2022

It would be nice if there would be some magic option that will allow to build boost::log with std::filesystem instead of boost::filesystem. This will help with symbol problems in static configuration caused by BOOST_FILESYSTEM_VERSION define.

@Lastique
Copy link
Member

Could you describe what kind of problems?

@Nekto89
Copy link
Author

Nekto89 commented Jul 21, 2022

Some public methods in boost::filesystem are marked as inline and have different implementation depending on BOOST_FILESYSTEM_VERSION. From Microsoft documentation: "The compiler treats the inline expansion options and keywords as suggestions. There's no guarantee that functions will be inlined. You can't force the compiler to inline a particular function, even with the __forceinline keyword. "

In some rare cases these simple one-liners aren't being inlined. So if boost is used as static library (users of shared libraries are safe :)), it might lead to situations when wrong version of method is linked in final binary. For example, if libboost_filesystem.lib has this "inlined" method with v4 and user's code (.obj/.lib files) expects that v3 will be called.

I've already replaced all boost::filesystem usages from my code, only transitive boost::process and boost::log are left.
boost::process will have "BOOST_PROCESS_USE_STD_FS" in next version.
It would be nice if it would be possible to have similar define in boost::log.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants