Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Active Template Library

From Wikipedia, the free encyclopedia
Active Template Library
Developer(s)Microsoft
Written inC++
Operating systemMicrosoft Windows
TypeLibrary orframework
LicenseProprietary
Windows development library

TheActive Template Library (ATL) is a set of template-basedC++ classes developed byMicrosoft, intended to simplify the programming ofComponent Object Model (COM) objects. The COM support inMicrosoft Visual C++ allows developers to create a variety of COM objects,OLE Automation servers, andActiveX controls.[1][2] ATL includes an object wizard that sets up primary structure of the objects quickly with a minimum of hand coding. On the COM client side ATL providessmart pointers that deal with COM reference counting. The library makes heavy use of thecuriously recurring template pattern.

History

[edit]

COM objects can also be created withMicrosoft Foundation Classes (MFC), but this leads to larger binaries that require supportDLLs.[3] ATL, on the other hand, is a more lightweight alternative in situations where the graphical user interface parts of MFC are not required.[4]

Older versions of ATL (ATL prior to version 7.1,pre-Visual Studio 2005) are incompatible withDEP because it places executablethunks in data heap.[5][6][7] This problem can be mitigated with DEP-ATL thunk emulation with performance penalty.[8][9]

In ATL version 7 (Visual Studio 2003), which directly succeeded version 3 (Visual Studio 6.0), a number of MFC classes like CString were made available in ATL, or more precisely moved to an ATLMFC common layer which is shared by both libraries. ATL version 7 also introduced attributes in C++ in an attempt to provide something similar toCLI attributes, however these have not been particularly successful, and have been deemphasized in ATL version 8 (Visual Studio 2005); the various wizards no longer generate them by default. Version 7 also introduced new string conversion classes.

On July 28, 2009, Microsoft released a patch to ATL to fix a bug that could allowActiveX controls created using ATL to be vulnerable to a remote code execution security flaw.[10]

Since Visual Studio 2013 (ATL version 12), all ATL code is static, eliminating the DLL.[11][12]

ATL version is defined by ATL_VER macros and can be queried via AtlGetVersion() function.[13]

Support classes

[edit]

ATL includes manyRAII classes to simplify management of COM types. The most commonly used classes include:

  • CComPtr<T>[14] general-purpose smart-pointer,
  • CComBSTR[15] BSTR wrapper,
  • CComVariant[16] VARIANT wrapper, and
  • CComSafeArray<T>[17] SAFEARRAY wrapper.

Compiler COM support

[edit]

Although not formally part of ATL, Microsoft Visual C++ also includes additional C++ RAII classes to simplify management of COM types. Thesecompiler COM support classes can be used as replacement for or in combination with ATL, and includes:

  • _com_ptr_t[18] smart-pointer that decorates the COM interface name with a "Ptr" suffix,
  • _bstr_t[19] BSTR wrapper,
  • _variant_t[20] VARIANT wrapper, and
  • _com_error[21] HRESULT wrapper.

Note that as of Visual Studio 2012, the compiler COM support classes does not include a SAFEARRAY wrapper.

See also

[edit]

References

[edit]
  1. ^Grimes, Richard (1998)."ATL and COM".ATL COM (1st ed.). Wrox Press. p. 6.ISBN 1-86100-249-1.
  2. ^Grimes, Richard (1999)."Building and calling a COM object using ATL".Beginning ATL 3 COM Programming (1st ed.). Wrox Press. p. 63.ISBN 978-1-86100-120-7.
  3. ^Williams, Mickey (2000). "Active Documents".Visual C++ 6 Unleashed (1st ed.). Sams. p. 733.ISBN 978-0-672-31241-0.
  4. ^Microsoft MSDN:Recommendations for Choosing Between ATL and MFC
  5. ^http://web.archive.org/web/20080130115007/http://blogs.msdn.com/michael_howard/archive/2008/01/29/new-nx-apis-added-to-windows-vista-sp1-windows-xp-sp3-and-windows-server-2008.aspx
  6. ^https://learn.microsoft.com/en-us/archive/blogs/michael_howard/new-nx-apis-added-to-windows-vista-sp1-windows-xp-sp3-and-windows-server-2008
  7. ^https://msrc.microsoft.com/blog/2009/06/understanding-dep-as-a-mitigation-technology-part-1/
  8. ^http://web.archive.org/web/20090123222148/http://support.microsoft.com/kb/948468
  9. ^https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-updateprocthreadattribute
  10. ^"ATL Security Update".MSDN. Microsoft. 2009-07-28. Retrieved2011-09-19.
  11. ^http://web.archive.org/web/20130827013146/http://blogs.msdn.com/b/vcblog/archive/2013/08/20/atl-and-mfc-changes-and-fixes-in-visual-studio-2013.aspx
  12. ^https://devblogs.microsoft.com/cppblog/atl-and-mfc-changes-and-fixes-in-visual-studio-2013/
  13. ^https://learn.microsoft.com/en-us/cpp/atl/reference/atl-text-encoding-functions?view=msvc-170#atlgetversion
  14. ^Microsoft MSDN:CComPtr Class
  15. ^Microsoft MSDN:CComBSTR Class
  16. ^Microsoft MSDN:CComVariant Class
  17. ^Microsoft MSDN:CComSafeArray Class
  18. ^Microsoft MSDN:_com_ptr_t Class
  19. ^Microsoft MSDN:_bstr_t Class
  20. ^Microsoft MSDN:_variant_t Class
  21. ^Microsoft MSDN:_com_error Class

External links

[edit]
International
National
Retrieved from "https://en.wikipedia.org/w/index.php?title=Active_Template_Library&oldid=1298946355"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp