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

Remove std templates from interface #34

Open
lppinto opened this issue May 25, 2020 · 2 comments
Open

Remove std templates from interface #34

lppinto opened this issue May 25, 2020 · 2 comments

Comments

@lppinto
Copy link

lppinto commented May 25, 2020

I would remove std::string (and other templates) from the interface and would replace it with const char* when returning for example the file name, etc. I believe this might be problematic if one tries to link a debug library with the release version of the cppfs

@Caldfir
Copy link

Caldfir commented Jul 8, 2020

I believe this is related to some warnings I'm getting from VisualStudio:

2>vcpkg\installed\x64-windows\include\cppfs/FilePath.h(348,23): warning C4251: 'cppfs::FilePath::m_path': class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'cppfs::FilePath'
2>F:\Programs\VisualStudio\VC\Tools\MSVC\14.26.28801\include\xstring(4575): message : see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
2>vcpkg\installed\x64-windows\include\cppfs/FilePath.h(352,35): warning C4251: 'cppfs::FilePath::m_fullPath': class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'cppfs::FilePath'
2>F:\Programs\VisualStudio\VC\Tools\MSVC\14.26.28801\include\xstring(4575): message : see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
2>vcpkg\installed\x64-windows\include\cppfs/FilePath.h(353,35): warning C4251: 'cppfs::FilePath::m_filename': class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'cppfs::FilePath'
2>F:\Programs\VisualStudio\VC\Tools\MSVC\14.26.28801\include\xstring(4575): message : see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
2>vcpkg\installed\x64-windows\include\cppfs/FilePath.h(354,35): warning C4251: 'cppfs::FilePath::m_basename': class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'cppfs::FilePath'
2>F:\Programs\VisualStudio\VC\Tools\MSVC\14.26.28801\include\xstring(4575): message : see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
2>vcpkg\installed\x64-windows\include\cppfs/FilePath.h(355,36): warning C4251: 'cppfs::FilePath::m_extension': class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'cppfs::FilePath'
2>F:\Programs\VisualStudio\VC\Tools\MSVC\14.26.28801\include\xstring(4575): message : see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
2>vcpkg\installed\x64-windows\include\cppfs/FilePath.h(356,40): warning C4251: 'cppfs::FilePath::m_directoryPath': class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'cppfs::FilePath'
2>F:\Programs\VisualStudio\VC\Tools\MSVC\14.26.28801\include\xstring(4575): message : see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'
2>vcpkg\installed\x64-windows\include\cppfs/FilePath.h(357,38): warning C4251: 'cppfs::FilePath::m_driveLetter': class 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>' needs to have dll-interface to be used by clients of class 'cppfs::FilePath'
2>F:\Programs\VisualStudio\VC\Tools\MSVC\14.26.28801\include\xstring(4575): message : see declaration of 'std::basic_string<char,std::char_traits<char>,std::allocator<char>>'

I'm sort of confused why the error is showing up when I'm building an executable, not a dll, and C4251 seems to explicitly be about dll compilation. It isn't hurting me, but warnings are annoying.

@lppinto
Copy link
Author

lppinto commented Jul 9, 2020

If some include prototypes declares a class that has public or even private stl members, this might be the case… I for once would use the pimpl pattern to hide those complex members that don't have dll interface exports (stl templates) and would substitute those with getters to get more simplified types (std::string -> const char*)

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