摘要: 1. 使用__declspec(dllexport) [代码]2. 使用def文件 exports EXPORTS SetKeyboardHook3. 在link中使用/EXPORT 说明#pragma comment(linker,"/EXPORT:SetKeyboardHook") 阅读全文
posted @ 2010-06-07 22:53 D_Arthas 阅读(236) 评论(0) 推荐(0) 编辑
摘要: Four preprocessor-specific operators are used in the context of the #define directive (see the following list for a summary of each). The stringizing, charizing, and token-pasting operators are discus... 阅读全文
posted @ 2010-05-31 15:27 D_Arthas 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Lazy Load目的是为了避免过早载入占用较多资源的对象或其他系统资源。譬如PC游戏,如果没有手柄,就没有必要在游戏运行时就载入手柄相关的模块,可以等到需要手柄是再载入。 1. Lazy Initiliaze 设置一个标记位标识是否已载入对象,如果访问对象时未载入该对象,那么载入对象 2. Vritual Proxy 使用一个和目标对象接口相同的代理类。当代理类方法被调用时,将载入目标对象。目标... 阅读全文
posted @ 2010-05-18 18:12 D_Arthas 阅读(342) 评论(0) 推荐(1) 编辑
摘要: 我们将对下面这个带简单条件判断的方法使用ILGeneral在运行期生成 [代码]1. 定义本地变量[代码]2. 对变量赋值使用LDC_I4_0将整数1压到栈上将栈上的值pop,赋值给本地变量LOC_0 (i)[代码]3. 分支语句需要一个标签(Label)[代码]4. 判断 i > 0 的结果将本地变量i的值压到栈上将整数0压到栈上 判断i是否比0大,如果是,1将会被压到栈上,否则0被压到栈... 阅读全文
posted @ 2010-05-17 14:38 D_Arthas 阅读(177) 评论(0) 推荐(0) 编辑
摘要: .net提供了在运行期动态创建类型的机制。Spring.net 中应用其中的实现来实现AOPProxy. 对于类,需要制定Assembly, Module, Class Name以及类中的成员。 对MSDN上面的代码解释一下: 首先制定需要创建类型的Assembly和Module [代码]通过使用ModuleBuilder创建TypeBuilder[代码]创建成员字段[代码]创建Construc... 阅读全文
posted @ 2010-04-21 17:13 D_Arthas 阅读(294) 评论(0) 推荐(0) 编辑