boostorg / winapi

Windows API declarations without <windows.h>, for internal Boost use.
63 stars 55 forks source link

GetModuleFileNameA is available at Cygwin #45

Closed apolukhin closed 7 years ago

apolukhin commented 7 years ago

However users complain, that it is not available from Boost.WinAPI:

Phil Bouchard:

  • I had to change the scope of GetModuleFileNameA in: if (!GetModuleFileNameA(handle, filename, DEFAULT_PATHSIZE))

Currently that line looks like this https://github.com/boostorg/stacktrace/blob/1614e8ff7d79c091bc9216f4f138670db3db8a33/include/boost/stacktrace/detail/location_from_symbol.hpp#L58 , so Phil dropped the boost::detail::winapi:: to use the global function

Lastique commented 7 years ago

You can see in https://github.com/boostorg/winapi/blob/develop/include/boost/detail/winapi/dll.hpp#L145 that GetModuleFileNameA is provided but conditioned on BOOST_NO_ANSI_APIS, which is a Boost.Config macro defined on some Windows versions. I don't see how it could have been defined for Cygwin, other that it was defined by user or some code, but I think that's the problem.

In general though, you should either check for BOOST_NO_ANSI_APIS as well and use A or W functions accordingly or just always use W functions. I think there are a few exceptions, but most of the Windows API is universally available in W variant.

Lastique commented 7 years ago

Also, make sure you included boost/detail/winapi/dll.hpp.