Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Active Template Library
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Infobox software | name = Active Template Library | logo = | screenshot = | caption = | collapsible = | author = | developer = [[Microsoft]] | released = | latest release version = | latest release date = | latest preview version = | latest preview date = | programming language = [[C++]] | operating system = [[Microsoft Windows]] | platform = | size = | language = | genre = [[Library (computing)|Library]] or [[Software framework|framework]] | license = [[Proprietary software|Proprietary]] | website = }}{{Short description|Windows development library}} The '''Active Template Library''' (ATL) is a set of template-based [[C++]] classes developed by [[Microsoft]], intended to simplify the programming of [[Component Object Model]] (COM) objects. The COM support in [[Microsoft Visual C++]] allows developers to create a variety of COM objects, [[OLE Automation]] servers, and [[ActiveX]] controls.<ref>{{cite book | title = ATL COM | edition = 1st | chapter = ATL and COM | page = [https://archive.org/details/atlcomprogrammer00grim/page/6 6] | last = Grimes | first = Richard | year = 1998 | publisher = Wrox Press | isbn = 1-86100-249-1 | chapter-url-access = registration | chapter-url = https://archive.org/details/atlcomprogrammer00grim/page/6 }}</ref><ref>{{cite book | title = Beginning ATL 3 COM Programming | edition = 1st | chapter = Building and calling a COM object using ATL | page = [https://archive.org/details/beginningatl3com00grim/page/63 63] | last = Grimes | first = Richard | year = 1999 | publisher = Wrox Press | isbn = 978-1-86100-120-7 | chapter-url-access = registration | chapter-url = https://archive.org/details/beginningatl3com00grim/page/63 }}</ref> 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 provides [[smart pointer]]s that deal with COM reference counting. The library makes heavy use of the [[curiously recurring template pattern]]. == History == COM objects can also be created with [[Microsoft Foundation Classes]] (MFC), but this leads to larger binaries that require support [[dynamic-link library|DLL]]s.<ref>{{cite book | title = Visual C++ 6 Unleashed | edition = 1st | chapter = Active Documents | page = 733 | last = Williams | first = Mickey | year = 2000 | publisher = Sams | isbn = 978-0-672-31241-0 }}</ref> ATL, on the other hand, is a more lightweight alternative in situations where the graphical user interface parts of MFC are not required.<ref>Microsoft MSDN: [https://msdn.microsoft.com/en-us/library/bk8ytxz5.aspx Recommendations for Choosing Between ATL and MFC]</ref> Older versions of ATL (ATL prior to version 7.1, [[Visual_Studio#History|pre-Visual Studio 2005]]) are incompatible with [[Data Execution Prevention#Windows|DEP]] because it places executable [[thunk]]s in data heap.<ref>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</ref><ref>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</ref><ref>https://msrc.microsoft.com/blog/2009/06/understanding-dep-as-a-mitigation-technology-part-1/</ref> This problem can be mitigated with DEP-ATL thunk emulation with performance penalty.<ref>http://web.archive.org/web/20090123222148/http://support.microsoft.com/kb/948468</ref><ref>https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-updateprocthreadattribute</ref> 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 to [[Metadata (CLI)#Attributes|CLI 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 allow [[ActiveX]] controls created using ATL to be vulnerable to a remote code execution security flaw.<ref>{{cite web|url=http://msdn.microsoft.com/en-us/visualc/ee309358.aspx |title=ATL Security Update |publisher= Microsoft|work = MSDN| date=2009-07-28 |access-date=2011-09-19}}</ref> Since Visual Studio 2013 (ATL version 12), all ATL code is static, eliminating the DLL.<ref>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</ref><ref>https://devblogs.microsoft.com/cppblog/atl-and-mfc-changes-and-fixes-in-visual-studio-2013/</ref> ATL version is defined by ATL_VER macros and can be queried via AtlGetVersion() function.<ref>https://learn.microsoft.com/en-us/cpp/atl/reference/atl-text-encoding-functions?view=msvc-170#atlgetversion</ref> == Support classes == ATL includes many [[Resource Acquisition Is Initialization|RAII]] classes to simplify management of COM types. The most commonly used classes include: * <code>CComPtr<T></code><ref>Microsoft MSDN: [https://msdn.microsoft.com/en-us/library/ezzw7k98.aspx CComPtr Class]</ref> general-purpose smart-pointer, * <code>CComBSTR</code><ref>Microsoft MSDN: [https://msdn.microsoft.com/en-us/library/zh7x9w3f.aspx CComBSTR Class]</ref> BSTR wrapper, * <code>CComVariant</code><ref>Microsoft MSDN: [https://msdn.microsoft.com/en-us/library/ac97df2h.aspx CComVariant Class]</ref> VARIANT wrapper, and * <code>CComSafeArray<T></code><ref>Microsoft MSDN: [https://msdn.microsoft.com/en-us/library/3xzbsee8.aspx CComSafeArray Class]</ref> SAFEARRAY wrapper. == Compiler COM support == Although not formally part of ATL, Microsoft Visual C++ also includes additional C++ RAII classes to simplify management of COM types. These ''compiler COM support'' classes can be used as replacement for or in combination with ATL, and includes: * <code>_com_ptr_t</code><ref>Microsoft MSDN: [https://msdn.microsoft.com/en-us/library/417w8b3b.aspx _com_ptr_t Class]</ref> smart-pointer that decorates the COM interface name with a "Ptr" suffix, * <code>_bstr_t</code><ref>Microsoft MSDN: [https://msdn.microsoft.com/en-us/library/zthfhkd6.aspx _bstr_t Class]</ref> BSTR wrapper, * <code>_variant_t</code><ref>Microsoft MSDN: [https://msdn.microsoft.com/en-us/library/x295h94e.aspx _variant_t Class]</ref> VARIANT wrapper, and * <code>_com_error</code><ref>Microsoft MSDN: [https://msdn.microsoft.com/en-us/library/0ye3k36s.aspx _com_error Class]</ref> HRESULT wrapper. Note that as of Visual Studio 2012, the compiler COM support classes does not include a SAFEARRAY wrapper. == See also == * [[ATL Server]] *[[C++/CX]] * [[OLE Automation]] * [[Standard Template Library]] * [[Windows Template Library]] * [[Microsoft Windows SDK]] * [[List of C++ template libraries]] == References == {{Reflist}} == External links == * [https://msdn.microsoft.com/en-us/library/t9adwcde.aspx Official MSDN reference documentation] {{Authority control}} [[Category:C++ libraries]] [[Category:Microsoft application programming interfaces|Template Library]]
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)
Pages transcluded onto the current version of this page
(
help
)
:
Template:Authority control
(
edit
)
Template:Cite book
(
edit
)
Template:Cite web
(
edit
)
Template:Infobox
(
edit
)
Template:Infobox software
(
edit
)
Template:Main other
(
edit
)
Template:Reflist
(
edit
)
Template:Short description
(
edit
)
Template:Template other
(
edit
)