runtime

Bundle .NET dlls to run application in .NET-less machine?

南楼画角 提交于 2019-11-30 19:48:04
AFAIK, ngen turns MSIL into native code (also reffered to as pre-JIT), however I never payed too much attention at it's startup performance impact. Ngen'd applications still require the .NET base class libraries (the runtime). Since the base class libraries have everything our .NET assemblies need (correct?) would it be possible to ship the framework's DLLs with my ngen'd application so that it does not require the runtime to be installed? (e.g., the scenario for most Windows XP machines) Oh, and please don't bother mentioning Remotesoft's Salamander Linker or Xenocode's Postbuild . They are

Java Runtime.addShutdownHook()方法

二次信任 提交于 2019-11-30 19:08:48
java.lang.Runtime.addShutdownHook(Thread hook) 方法注册一个新的虚拟机关闭挂钩。 Java虚拟机的关机响应于两种类型的事件: 通常情况下,程序退出时的最后一个非守护线程退出时或退出(等价地,System.exit)方法被调用,或 虚拟机终止在响应于一个用户中断,如打字^ C,或一个全系统的事件,如用户注销或系统关闭. 关闭钩子是一个简单的初始化但尚未启动的线程。当虚拟机开始关机顺序,将一些未指定的顺序启动所有已注册的关闭钩子,让它们同时运行。当所有的钩子已经完成,它会然后运行所有uninvoked的终结,如果最终确定的出口已启用。最后,虚拟机将暂停。需要注意的是守护线程将继续运行在关机过程中,作为非守护线程,如果关机是通过调用exit方法. 声明 以下是声明java.lang.Runtime.addShutdownHook()方法 public void addShutdownHook(Thread hook) 参数 hook -- 一个初始化但尚未启动的线程对象 返回值 此方法不返回一个值。 异常 IllegalArgumentException -- 如果指定的钩已被注册,或如果它可以判定钩已经运行或已被运行 IllegalStateException -- 如果虚拟机已经是在关闭的过程中 SecurityException --

Runtime.addShutdownHook()(译)

时光毁灭记忆、已成空白 提交于 2019-11-30 19:08:38
序言: 每一个 Java 程序都可以为 JVM 增加一个关闭钩子。 JVM 将在关闭之前执行关闭钩子中的指令。 问题: 一个程序可能需要在退出前执行一些指令。程序可能由于下列原因而退出: 所有的线程已经执行完毕 调用 System.exit() 用户输入 Ctrl+C 系统级关闭或用户注销 适用场景: 保存应用状态,例如,当多数 IDE 退出时,它们将记忆最后的视图有哪些。 关闭某些数据库连接。 将应用关闭的消息发送给系统管理员。 解决方案: 关闭钩子支持所有这些场景。应用可以增加一个关闭钩子, JVM 将在应用退出时调用它。 抽象层次的概念: 将所有的指令( Java 代码)写入一个线程的 run() 内,并且调用 java.lang.Runtime.addShutdownHook(Thread t) 。该方法将这个线程注册为 JVM 的关闭钩子。在关闭 JVM 的时候, JVM 将并行地运行这些钩子(线程将在 JVM 关闭的时候启动)。 代码示例: public class AddShutdownHookSample { public void attachShutDownHook() { Runtime. getRuntime ().addShutdownHook( new Thread() { @Override public void run() { System.

How do I remove instance methods at runtime in Objective-C 2.0?

↘锁芯ラ 提交于 2019-11-30 18:22:59
Is it possible to remove methods added to a class with class_addMethod? Or if I want to do this, must I keep creating classes at runtime with objc_allocateClassPair and adding different sets of methods to them to vary the methods implemented? I'll accept answers that include hackery :-) In short, you can't. You could in the Objective-C 1.0 ABI/API via: OBJC_EXPORT void class_removeMethods(Class, struct objc_method_list *) OBJC2_UNAVAILABLE; But that function was removed in Objective-C 2.0 because removing methods is pretty much never the right answer. Certainly not often enough to justify the

install VC++ Debug Runtime Distributable

末鹿安然 提交于 2019-11-30 17:54:49
问题 Is there anyway to install or have VC++ Debug Runtime Distributable without installing Visual Studio ? Just to run a dll that has been compiled in debug mode using VS2013 on another machine that hasn't VS2013. 回答1: For testing purposes, you can include the Debug DLLs you need 'side-by-side' with your application. You can find them on a machine with VS 2013 installed: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\redist\Debug_NonRedist When you deploy your app, you must use Release

How to use Delphi Dlls without enabling Build with runtime packages

こ雲淡風輕ζ 提交于 2019-11-30 16:57:45
Recently i started a project with so many forms , frames and extra controls, so my application was swelling up and i am using 3 exes in my projects(all made in Delphi 2009) and these applications are also sharing same frames and forms. so i used dlls to share these forms. but a problem came saying different Tfont error. so i refferd online and came with the answer saying to select | Build with runtime packages . then every thing started to work perfectly but when i checked the windows Taskmanager | memusage it is ~ 21 500 kb (21.5 mb).( but mem usage is only 2000 kb without Build with runtime

How do I remove instance methods at runtime in Objective-C 2.0?

只谈情不闲聊 提交于 2019-11-30 16:50:22
问题 Is it possible to remove methods added to a class with class_addMethod? Or if I want to do this, must I keep creating classes at runtime with objc_allocateClassPair and adding different sets of methods to them to vary the methods implemented? I'll accept answers that include hackery :-) 回答1: In short, you can't. You could in the Objective-C 1.0 ABI/API via: OBJC_EXPORT void class_removeMethods(Class, struct objc_method_list *) OBJC2_UNAVAILABLE; But that function was removed in Objective-C 2

OC:浅析Runtime中消息转发机制

℡╲_俬逩灬. 提交于 2019-11-30 16:28:53
一、介绍 OC是一门动态性语言,其实现的本质是利用runtime机制。在runtime中,对象调用方法,其实就是给对象发送一个消息,也即objc_msgSend()。在这个消息发送的过程中,系统会进行一系列的操作,最终实现消息的成功转发或者异常的抛出。这个传递的过程就是消息的转发。 消息转发过程:1、动态解析 2、快转发(接收者重定向) 3、慢转发(完整转发,方法重定向) 二、示例 在Person类中.h文件中声明了一个吃的方法: eat ,但是.m中没有具体的实现。 @interface Person : NSObject -(void)eat; @end 然后在控制器中创建Person对象调用eat,发现crash了。 - (void)viewDidLoad { [super viewDidLoad]; Person *person = [[Person alloc] init]; [person eat]; } 实现结果和原因如下 crash: '-[Person eat]: unrecognized selector sent to instance 0x60000366f310 reason: methodSignatureForSelector方法中,返回了一个空的对应方法签名,最终导致程序报错崩溃 此时,针对这种情况,消息就进入了转发流程

Why are Runtime Exceptions “unchecked” in Java?

浪子不回头ぞ 提交于 2019-11-30 15:39:47
问题 Why does it make sense to have Runtime Exceptions UnChecked (as opposed to if they were Checked )? 回答1: If you didn't you would have to have try/catch blocks every time you accessed an array element, did a division operation and many other common scenarios. To put it another way, imagine this code: Map map = ... int i = ... (int[])map.get("foo")[3] = 2334 / i; would have to check for ClassCastException , ArrayIndexOutofBoundsException , ArithmeticException , UnsupportedOperationException and

MySQL Workbench crash on start on Windows

假如想象 提交于 2019-11-30 15:36:34
I`ve just installed my MySQL Workbench and it crashes on start and i really dont know what to do with it. Error codes from Event Log : Application Error Application that causes trobule: MySQLWorkbench.exe version: 6.2.3.12312, time signature: 0x541717ae Name of the module that causes error: KERNELBASE.dll, version: 6.1.7601.18409, time signature: 0x5315a05a exception code: 0xe0434352 error shift: 0x000000000000940d ID of process that cause trobule: 0x8c0 Hour of launching the application that causes error: 0x01cffc736e910602 Path of the applicatin that causes error: D:\Programy\MySQL Workbench