What is .tlb file?

本文介绍了TLB文件作为COM类型库的作用及其在VC中的使用方式,同时阐述了DLL的功能以及如何通过VC编译器将TLB转换为C++可使用的标准文件格式。
  1. tlb文件:com类型库文件,它包含接口相关信息。在需要使用对应com类的模块里,通过"#import xxx.tlb"来调用。
  2. dll: 动态连接库,它包含二进制代码,资源... , VC可以把tlb作为资源编译到dll中。
  3. 在VC下#import "A.tlb" no_namespace;编译后产生A.tlh和A.tli两个文件,不生成namespace,如果没有no_namespace,则生成的内容都在namespace A中。如果dll中含有tlb资源,则也可以使用#import "xxx.dll"来生成tlh和tli文件。一般的c++ dll不能使用#import "xxx.dll"。
  4. tlh、tli文件:是vc++编译器解析tlb文件生成的标准c++文件。因为tlb并不是C++标准的东东,有必要把它们翻译成标准的C++类型,使得C++开发者可以使用。tlh相当于类型申明(头文件),tli相当于定义实现(CPP文件,inline)。
/* 1613 * The madvise(2) system call. 1614 * 1615 * Applications can use madvise() to advise the kernel how it should 1616 * handle paging I/O in this VM area. The idea is to help the kernel 1617 * use appropriate read-ahead and caching techniques. The information 1618 * provided is advisory only, and can be safely disregarded by the 1619 * kernel without affecting the correct operation of the application. 1620 * 1621 * behavior values: 1622 * MADV_NORMAL - the default behavior is to read clusters. This 1623 * results in some read-ahead and read-behind. 1624 * MADV_RANDOM - the system should read the minimum amount of data 1625 * on any access, since it is unlikely that the appli- 1626 * cation will need more than what it asks for. 1627 * MADV_SEQUENTIAL - pages in the given range will probably be accessed 1628 * once, so they can be aggressively read ahead, and 1629 * can be freed soon after they are accessed. 1630 * MADV_WILLNEED - the application is notifying the system to read 1631 * some pages ahead. 1632 * MADV_DONTNEED - the application is finished with the given range, 1633 * so the kernel can free resources associated with it. 1634 * MADV_FREE - the application marks pages in the given range as lazy free, 1635 * where actual purges are postponed until memory pressure happens. 1636 * MADV_REMOVE - the application wants to free up the given range of 1637 * pages and associated backing store. 1638 * MADV_DONTFORK - omit this area from child's address space when forking: 1639 * typically, to avoid COWing pages pinned by get_user_pages(). 1640 * MADV_DOFORK - cancel MADV_DONTFORK: no longer omit this area when forking. 1641 * MADV_WIPEONFORK - present the child process with zero-filled memory in this 1642 * range after a fork. 1643 * MADV_KEEPONFORK - undo the effect of MADV_WIPEONFORK 1644 * MADV_HWPOISON - trigger memory error handler as if the given memory range 1645 * were corrupted by unrecoverable hardware memory failure. 1646 * MADV_SOFT_OFFLINE - try to soft-offline the given range of memory. 1647 * MADV_MERGEABLE - the application recommends that KSM try to merge pages in 1648 * this area with pages of identical content from other such areas. 1649 * MADV_UNMERGEABLE- cancel MADV_MERGEABLE: no longer merge pages with others. 1650 * MADV_HUGEPAGE - the application wants to back the given range by transparent 1651 * huge pages in the future. Existing pages might be coalesced and 1652 * new pages might be allocated as THP. 1653 * MADV_NOHUGEPAGE - mark the given range as not worth being backed by 1654 * transparent huge pages so the existing pages will not be 1655 * coalesced into THP and new pages will not be allocated as THP. 1656 * MADV_COLLAPSE - synchronously coalesce pages into new THP. 1657 * MADV_DONTDUMP - the application wants to prevent pages in the given range 1658 * from being included in its core dump. 1659 * MADV_DODUMP - cancel MADV_DONTDUMP: no longer exclude from core dump. 1660 * MADV_COLD - the application is not expected to use this memory soon, 1661 * deactivate pages in this range so that they can be reclaimed 1662 * easily if memory pressure happens. 1663 * MADV_PAGEOUT - the application is not expected to use this memory soon, 1664 * page out the pages in this range immediately. 1665 * MADV_POPULATE_READ - populate (prefault) page tables readable by 1666 * triggering read faults if required 1667 * MADV_POPULATE_WRITE - populate (prefault) page tables writable by 1668 * triggering write faults if required 1669 * 1670 * return values: 1671 * zero - success 1672 * -EINVAL - start + len < 0, start is not page-aligned, 1673 * "behavior" is not a valid value, or application 1674 * is attempting to release locked or shared pages, 1675 * or the specified address range includes file, Huge TLB, 1676 * MAP_SHARED or VMPFNMAP range. 1677 * -ENOMEM - addresses in the specified range are not currently 1678 * mapped, or are outside the AS of the process. 1679 * -EIO - an I/O error occurred while paging in data. 1680 * -EBADF - map exists, but area maps something that isn't a file. 1681 * -EAGAIN - a kernel resource was temporarily unavailable. 1682 */
最新发布
11-14
Operating Systems Courses in operating systems cover the design of the components of an operating system—scheduler, memory manager, file system, etc. Only a small fraction of programmers ever write this kind of code, though. On the other hand, they can access many features of the OS using system calls such as fork, wait, exec, etc. This level of programming is not generally covered in any course. In Chapter 8, we describe process management, and how programmers can make use of the process control features of Unix and Linux. Other Topics We cover a wide range of systems topics, all from a programmer's perspective. Besides those mentioned above, these include machine-level programming, optimizing compilers, processor architecture, linking, performance measurement, virtual memory, I/O, network programming and concurrency. In viewing what to cover about a subject and how to present it, we have used the filter “How could a sophisticated application programmer make use of this material?” Key Points The material in this book has direct value for programmers. Students find that it explains many of the mysterious problems they've already encountered, that it helps them write and debug code more efficiently, and that their programs are more reliable and efficient. Even if this is the only systems course they ever take, they will have achieved a higher level of competence than many entry-level programmers. The material in this book is unique. Much of it is not presented in any other book or taught in previous courses. Instead, a traditional coverage of systems requires programmers to figure out on their own how the characteristics of the systems they study in builder-centric courses can be exploited to improve their programs. Programmers must struggle through confusing Unix man pages or read advanced systems programming books just to use the simple process control functions provided by Unix. The book provides a solid foundation for builder-centric courses. We believe that more advanced systems courses should present systems from a builder's perspective. Students will be much better oriented to the needs and constraints of these systems by first studying them from a programmer's perspective. At Carnegie Mellon, our Introduction to Computer Systems course has become a prequisite for courses in both CS and ECE covering: operating systems, networking, compilers, computer graphics, computer architecture, and embedded system design. Copyright © 2011, 2015 Randal E. Bryant and David R. O'Hallaron翻译以上英文为中文
08-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值