Boost logo

Boost :

From: Alan Bellingham (alan_at_[hidden])
Date: 2002-02-23 15:15:42


"Peter Dimov" <pdimov_at_[hidden]>:

>From: "Alan Bellingham" <alan_at_[hidden]>
>> which would have the advantage of removing the explicit A/W identifiers
>> from the global namespace while still linking correctly to the external
>> functions (I think - the above is untested - how _do_ you locally
>> declare a global namespace function while within a function in an inner
>> namespace?).
>
>extern "C" functions in a namespace link correctly.

Thanks. So they do (and still introducing the name into that namespace).

In that case:

  #if !defined(__cplusplus)
      WINBASEAPI DWORD WINAPI GetFileAttributesA(IN LPCSTR lpFileName);
      WINBASEAPI DWORD WINAPI GetFileAttributesW(IN LPCWSTR lpFileName);
  # ifdef UNICODE
  # define GetFileAttributes GetFileAttributesW
  # else
  # define GetFileAttributes GetFileAttributesA
  # endif // !UNICODE
  #else
    namespace Win32 {
      extern "C" {
        WINBASEAPI DWORD WINAPI GetFileAttributesW(IN LPCWSTR FileName);
        WINBASEAPI DWORD WINAPI GetFileAttributesA(IN LPCSTR FileName);
      }
      inline DWORD GetFileAttributes(char const* FileName)
      {
        return GetFileAttributesA(FileName) ;
      }
      inline DWORD GetFileAttributes(wchar_t const* FileName)
      {
        return GetFileAttributesW(FileName) ;
      }
    } // namespace Win32 {
  #endif // !defined(__cplusplus)


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk