All datatype and function prototype information in IDA is stored in TIL files. IDA ships with type library information for many major compilers and APIs stored in the <IDADIR>/til directory. The Types window (View ▸ Open subview ▸ Type Libraries) lists currently loaded .til files and is used to load additional .til files that you may wish to use. Type libraries are loaded automatically based on attributes of the binary discovered during the analysis phase. Under ideal circumstances, most users will never need to deal with .til files directly.
In some cases, IDA may fail to detect that a specific compiler was used to build a binary, perhaps because the binary has undergone some form of obfuscation. When this happens, you may load additional .til files by pressing the insert key within the Types window and selecting the desired .til files. When a new .til file is loaded, all structure definitions contained in the file are added to the list of standard structures, and type information is applied for any functions within the binary that have matching prototypes in the newly loaded .til file. In other words, when IDA gains new knowledge about the nature of a function, it automatically applies that new knowledge.
IDA also makes use of .til files to store any custom structure definitions that you create manually in the Structures window or through parsing C header files. Such structures are stored in a dedicated .til file associated with the database in which they were created. This file shares the base name of the database and has a .til extension. For a database named some_file.idb, the associated type library file would be some_file.til. Under normal circumstances you will never see this file unless you happen to have the database open in IDA. Recall that an .idb file is actually an archive file (similar to a .tar file) used to hold the components of a database when they are not in use. When a database is opened, the component files (the .til file being one of them) are extracted as working files for IDA.
A discussion regarding how to share .til files across databases can be found at http://www.hex-rays.com/forum/viewtopic.php?f=6&t=986.[47] Two techniques are mentioned. The first technique is somewhat unofficial and involves copying the .til file from an open database into your IDA til directory from which it can be opened, in any other database, via the Types window. A more official way to extract the custom type information from a database is to generate an IDC script that can be used to re-create the custom structures in any other database. Such a script can be generated using the File ▸ Produce File ▸ Dump Typeinfo to IDC File command. However, unlike the first technique, this technique dumps only the structures listed in the Structures window, which may not include all structures parsed from C header files (whereas the .til file-copying technique will).
Hex-Rays also provides a standalone tool, named tilib, for creating .til files outside of IDA. The utility is available as a .zip file for registered users via the Hex-Rays IDA download page. Installation is as simple as extracting the .zip file contents into <IDADIR>. The tilib utility may be used to list the contents of existing .til files or create new .til files by parsing C (not C++) header files. The following command would list the contents of the Visual Studio 6 type library:
C:\Program Files\IdaPro>tilib -l til\pc\vc6win.til
Creating a new .til file involves naming the header file to be parsed and the .til file to be created. Command line options allow you to specify additional include file directories or, alternatively, previously parsed .til files in order to resolve any dependencies contained in your header file. The following command creates a new .til file containing the declaration of ch8_struct. The resulting .til file must be moved into <IDADIR>/til before IDA can make use of it.
C:\Program Files\IdaPro>tilib -c -hch8_struct.h ch8.til
The tilib utility contains a substantial number of additional capabilities, some of which are detailed in the README file included with the tilib distribution, and others of which are briefly detailed by running tilib with no arguments. Prior to version 6.1, tilib is distributed only as a Windows executable; however, the .til files that it generates are compatible with all versions of IDA.