native-methods

Adobe Air Native Process with Java

走远了吗. 提交于 2019-12-12 02:17:50
问题 Does Adobe Air Native process only allows to call .exe file only which runs a java class ? And not accessing a certain method in the java class? 回答1: You can run java applications by running java.exe with native process and passing appropriate arguments. See Running java from cmd. 来源: https://stackoverflow.com/questions/8075085/adobe-air-native-process-with-java

C# Implement Late Binding for Native Code

一笑奈何 提交于 2019-12-11 23:23:36
问题 We are working with an existing native application (most likely written in VB) that loads assemblies and calls methods with "Late Binding." We do NOT have access to its source code. We want to implement this interface in C#, and have the native application call our C# assembly. Is this something that's possible? Is this anything we have to do beyond matching the method names and method signatures to make it work? 回答1: If you're trying to call .NET code from VB6 the cleanest way would be to

Parameter passing in native a method [duplicate]

為{幸葍}努か 提交于 2019-12-11 11:43:31
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: jni converting jstring to char * There is a function on С (traverser.c module) long int Traverser(const char * sTraversingRoot) { long int nCount; struct stat rStatBuf; time_t nTime; char sActualPath[512]; PGconn *pConn; // Open DB connection sprintf(sConnInfo, "hostaddr=%s port=%s connect_timeout=50 dbname=%s user=%s password=%s", sIP, sPort, sDBName, sLogin, sPassword); pConn = PQconnectdb(sConnInfo); if

Is there a way to clone native functions in javascript like window.alert or document.write

回眸只為那壹抹淺笑 提交于 2019-12-11 01:51:30
问题 What I want to do is change every alert in the code to a custom alert("you used alert"); var hardCodedAlert = alert; //I know this won't work.But what to do ? window.alert=function(){ if(this.count == undefined) this.count=0; this.count=this.count+1; if(this.count == 1) hardCodedAlert("You used alert"); }; 回答1: Yes, you can do (for example): var oldalert = window.alert; window.alert= function alert(t){ alert.count = !alert.count ? 1 : alert.count + 1; oldalert(t+' - That\'s alert nr '+alert

Create JAVA class from C code

心不动则不痛 提交于 2019-12-11 00:57:36
问题 I have Class in java called XMLDOMDocument this class have some methods CreateXML , AddNode , RemoveNode etc. I call this methods from C code with the help of Java Native Interface, but for doing that I pass to the C code object of my JAVA class then by calling env->GetObjectClass(myclass) I get my class from that object and call methods of the JAVA class. I want to know can I do same thing (call JAVA methods) without passing my class to the C code. Can I create JAVA class right in C code and

Is the class NativeMethods handled specially in .NET?

落爺英雄遲暮 提交于 2019-12-09 02:49:35
问题 https://msdn.microsoft.com/en-us/library/ms182161.aspx Are the three classes described on this paged handled specially in the .NET Framework? (NativeMethods, SafeNativeMethods and UnsafeNativeMethods) The reason I'm asking is I'm wondering if it is alright to create categories of NativeMethods classes. For example: ComNativeMethods User32NativeMethods OleStorageNativeMethods 回答1: It's a convention, not a requirement. If you reflect into the CLR and take a look at code in there, you'll often

JVM (HotSpot) : Where do all the methods go ? method area ? native method stack?

北战南征 提交于 2019-12-08 23:09:26
I am new to JVM (HotSpot), and try to understand the architecture of it and how it works, so my question is that do all the methods (both static and non-static) get translated into byte-code ? and when JVM loads the class files, does it load all the methods into somewhere ? like method area ? or native method stacks ? mikera It's dependent on the JVM implementation - different JVMs may choose to handle this in different ways (as long as they conform to the Java spec). So you have no absolute guarantees. In the Sun/Oracle JVM the method data gets loaded into a special memory area called the

running dll method Javafx

馋奶兔 提交于 2019-12-08 17:55:34
I have C program (Dll) which I can call from Java using JNI. I want to use Javafx for the interface so I made a java class to call the dll. I am able to load the dll but I cannot call the method. The error message it gives me is java.lang.UnsatisfiedLinkError: mark1.Small_test.tester(DDDLjava/lang/String;Ljava/lang/String;Ljava/lang/String;DDD)[D java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) I have used the same Dll and it works if I call with normal

Is it possible to override a native method in a Java class in Android/dalvik?

限于喜欢 提交于 2019-12-05 19:05:27
问题 I am unit testing a class TestMe using EasyMock, and one of its methods (say method(N n) ) expects a parameter of type N which has a native method (say nativeMethod() ). class TestMe { void method(N n) { // Do stuff n.nativeMethod(); // Do more stuff } } method() needs to invoke N.nativeMethod() at some point, and the problem I'm having is that my Easymock mock object for N is unable to override the native method. I do not own class N but I can refactor TestMe in any way necessary. I decided

How to correctly call P/Invoke methods in a class library?

♀尐吖头ヾ 提交于 2019-12-04 17:56:23
I have multiple projects in a Visual Studio 2015 solution. Several of these projects do P/Invokes like: [DllImport("IpHlpApi.dll")] [return: MarshalAs(UnmanagedType.U4)] public static extern int GetIpNetTable(IntPtr pIpNetTable, [MarshalAs(UnmanagedType.U4)] ref int pdwSize, bool bOrder); So I moved all my P/Invokes to a separate class library and defined the single class as: namespace NativeMethods { [ SuppressUnmanagedCodeSecurityAttribute(), ComVisible(false) ] public static class SafeNativeMethods { [DllImport("kernel32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] public static