KR20120072105A - Apparatus and method for invoking native libraries by java application - Google Patents

Apparatus and method for invoking native libraries by java application Download PDF

Info

Publication number
KR20120072105A
KR20120072105A KR1020100133899A KR20100133899A KR20120072105A KR 20120072105 A KR20120072105 A KR 20120072105A KR 1020100133899 A KR1020100133899 A KR 1020100133899A KR 20100133899 A KR20100133899 A KR 20100133899A KR 20120072105 A KR20120072105 A KR 20120072105A
Authority
KR
South Korea
Prior art keywords
native library
native
call
library
function
Prior art date
Application number
KR1020100133899A
Other languages
Korean (ko)
Inventor
윤민홍
윤석진
이형석
김선자
Original Assignee
한국전자통신연구원
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 한국전자통신연구원 filed Critical 한국전자통신연구원
Priority to KR1020100133899A priority Critical patent/KR20120072105A/en
Publication of KR20120072105A publication Critical patent/KR20120072105A/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/451Execution arrangements for user interfaces
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • Human Computer Interaction (AREA)
  • Computer Hardware Design (AREA)
  • Devices For Executing Special Programs (AREA)

Abstract

PURPOSE: A native library calling apparatus of a java application and a method thereof are provided to utilize a function of a native library by calling a function of the native library through process communication with a platform or a VM(Virtual Machine). CONSTITUTION: A Java end caller(110) generates a native library call message by using native library information according to a native library call command of a Java application(10). The Java end caller transmits the message through inter-process communication(120). A native end caller(130) extracts the native library information by analyzing the call message.

Description

자바 애플리케이션의 네이티브 라이브러리 호출 장치 및 그 방법{APPARATUS AND METHOD FOR INVOKING NATIVE LIBRARIES BY JAVA APPLICATION}Apparatus and method for calling native libraries in Java applications {APPARATUS AND METHOD FOR INVOKING NATIVE LIBRARIES BY JAVA APPLICATION}

본 발명은 자바 애플리케이션의 네이티브 라이브러리 호출 장치 및 그 방법에 관한 것으로서, 상세하게는 자바 애플리케이션의 네이티브 라이브러리 호출 명령에 따라 네이티브 라이브러리 호출 메시지를 생성하여 프로세스간 통신을 통해 송신하고, 송신된 네이티브 라이브러리 호출 메시지를 분석하여 함수를 호출하고, 그 호출된 함수의 호출 결과를 프로세스간 통신을 통해 자바 애플리케이션으로 전달함으로써, 자바 애플리케이션이 플랫폼 또는 가상 머신(VM: Virtual Machine)에 독립적으로 프로세스간 통신을 통해 네이티브 라이브러리의 함수를 호출하여 네이티브 라이브러리의 기능을 활용할 수 있는, 자바 애플리케이션의 네이티브 라이브러리 호출 장치 및 그 방법에 관한 것이다.The present invention relates to a native library calling apparatus and a method of a Java application, and more particularly, to generate a native library call message according to a native library call command of a Java application and to transmit it through inter-process communication, and to transmit the transmitted native library call message. By analyzing the function and calling the function, and passing the result of the called function to the Java application through inter-process communication, the Java application is a native library through inter-process communication independent of the platform or virtual machine (VM). The present invention relates to a native library calling device of a Java application and a method thereof that can utilize functions of a native library by calling a function of.

자바 언어는 모바일 환경에서 지속적으로 사용된 언어다. CLDC(Connected Limited Device Configuration)와 MIDP(Mobile Information Device Profile)로 대표되는 J2ME(java 2 Platform, Standard Edition)를 비롯해 한국의 무선 인터넷 표준 플랫폼인 WIPI(Wireless Internet Platform for Interoperability) 등에서 널리 사용되고 있다.The Java language continues to be used in mobile environments. It is widely used in Java 2 Platform, Standard Edition (J2ME), which is represented by the Connected Limited Device Configuration (CLDC) and Mobile Information Device Profile (MIDP), and the Wireless Internet Platform for Interoperability (WIPI).

자바 언어로 개발한 애플리케이션은 기본적으로 JVM/KVM(Java Virtual Machine)/(Kilobyte Virtual Machine)과 같은 가상 머신 위에서 동작하기 때문에 휴대폰과 같은 내장형 기기에서 안정성이 있다. 또한, 자바 언어는 C/C++ 언어나 어셈블리 언어보다 개발이 용이하고 개발자들이 많이 선호하는 언어로 모바일 환경에서 많이 사용되고 있다.Applications developed in the Java language run on top of virtual machines, such as JVM / KVM (Java Virtual Machine) / (Kilobyte Virtual Machine), which makes them reliable on embedded devices such as mobile phones. In addition, the Java language is easier to develop than the C / C ++ language or assembly language and is favored by many developers.

최근 출시된 스마트폰들에서도 자바를 이용해 애플리케이션을 사용하고 있어 모바일 환경에서 자바 언어는 점차 확대되고 있는 추세이다.Recently launched smartphones use applications using Java, so the Java language is gradually expanding in the mobile environment.

그러나 COD/AOTC(Compile On Demand)/(Ahead Of Time Compiler)를 채택하지 않는 경우, 자바로 작성된 애플리케이션은 가상 머신(예컨대, JVM, KVM, Dalvik VM 등) 위에서 동작하는 바이트 코드다. 네이티브 라이브러리는 실제 머신 위에서 동작하는 네이티브 바이너리이다. 따라서 자바로 작성된 애플리케이션은 바이트 코드를 해석해 실행해야 한다. 즉, 자바로 작성된 애플리케이션은 바이트 코드에서 네이티브 바이너리의 기능을 이용하기 위해선 이 둘을 연결해주는 메커니즘이 필요하며, 인터프리트 과정을 거치기 때문에 실행 속도의 측면에서 손해를 볼 수밖에 없다.However, without adopting COD / Compile On Demand / Ahead Of Time Compiler, an application written in Java is byte code running on a virtual machine (eg JVM, KVM, Dalvik VM, etc.). Native libraries are native binaries that run on real machines. Therefore, applications written in Java must interpret and execute byte code. In other words, an application written in Java needs a mechanism to connect the two to take advantage of the native binary features in bytecode, and because of the interpreting process, there is a loss in terms of execution speed.

처리 속도 측면의 손해를 극복하고자 JNI(Java Native Interface), RNI(Raw Native Interface) 등의 방법이 널리 사용되고 있다. 또한, 일부 스마트폰에서는 복잡하거나 핵심적인 연산은 네이티브 방식으로 수행할 수 있도록 NDK(Native Development Kit)를 제공하기도 한다.In order to overcome the damage in terms of processing speed, methods such as Java Native Interface (JNI) and Raw Native Interface (RNI) are widely used. Some smartphones also offer the Native Development Kit (NDK) to perform complex or critical operations in a native way.

그러나 이들 모두에서 플랫폼 의존적이라는 한계가 있다. 또한, 플랫폼이나 가상 머신이 바뀌는 경우, 그에 맞는 방법을 채택해야 하는 단점이 있다.But all of them have the limitation of being platform dependent. In addition, when the platform or the virtual machine changes, there is a disadvantage in that the appropriate method should be adopted.

본 발명은 상기의 문제점을 해결하기 위해 창안된 것으로서, 자바 애플리케이션의 네이티브 라이브러리 호출 명령에 따라 네이티브 라이브러리 호출 메시지를 생성하여 프로세스간 통신을 통해 송신하고, 송신된 네이티브 라이브러리 호출 메시지를 분석하여 함수를 호출하고, 그 호출된 함수의 호출 결과를 프로세스간 통신을 통해 자바 애플리케이션으로 전달함으로써, 자바 애플리케이션이 플랫폼 또는 가상 머신(VM: Virtual Machine)에 독립적으로 프로세스간 통신을 통해 네이티브 라이브러리의 함수를 호출하여 네이티브 라이브러리의 기능을 활용할 수 있는, 자바 애플리케이션의 네이티브 라이브러리 호출 장치 및 그 방법을 제공하는 것을 목적으로 한다.The present invention was devised to solve the above problems, and generates a native library call message according to a native library call command of a Java application and transmits it through interprocess communication, and analyzes the transmitted native library call message to call a function. By passing the result of the call of the called function to the Java application through interprocess communication, the Java application calls a function of the native library through interprocess communication independently of the platform or virtual machine (VM) to native It is an object of the present invention to provide a native library calling device and method for Java applications that can take advantage of the library functions.

이를 위하여, 본 발명의 제1 측면에 따른 장치는, 자바 애플리케이션의 네이티브 라이브러리 호출 명령에 따라 네이티브 라이브러리 정보를 이용하여 네이티브 라이브러리 호출 메시지를 생성하여 프로세스간 통신을 이용해 송신하고, 상기 송신된 네이티브 라이브러리 호출 메시지에 대한 네이티브 라이브러리 호출 결과를 프로세스간 통신을 이용해 수신하여 상기 자바 애플리케이션으로 전달하는 자바단 호출부; 상기 송신된 네이티브 라이브러리 호출 메시지를 분석하여 네이티브 라이브러리 정보를 추출하고, 상기 추출된 네이티브 라이브러리 정보에 포함된 함수를 네이티브 라이브러리에서 호출하여 함수 호출 결과를 상기 자바단 호출부로 프로세스간 통신을 이용해 송신하는 네이티브단 호출부; 및 상기 자바단 호출부와 상기 네이티브단 호출부 간의 송수신을 프로세스간 통신을 이용해 수행하는 프로세스간 통신부를 포함하는 것을 특징으로 한다.To this end, the apparatus according to the first aspect of the present invention generates a native library call message using native library information according to a native library call instruction of a Java application and transmits it using interprocess communication, and sends the transmitted native library call. A Java caller for receiving a native library call result for a message through interprocess communication and delivering the result to the Java application; The native library information is extracted by analyzing the transmitted native library call message, and a native that calls a function included in the extracted native library information in a native library and transmits a function call result to the Java calling page using inter-process communication. Only call; And an inter-process communication unit performing transmission and reception between the Java-term calling unit and the native-end calling unit using inter-process communication.

본 발명의 제2 측면에 따른 방법은, 자바 애플리케이션의 네이티브 라이브러리 호출 명령에 따라 네이티브 라이브러리 정보를 이용하여 네이티브 라이브러리 호출 메시지를 생성하는 호출 메시지 생성 단계; 상기 생성된 네이티브 라이브러리 호출 메시지를 프로세스간 통신을 이용해 송신하는 호출 메시지 송신 단계; 상기 송신된 네이티브 라이브러리 호출 메시지를 분석하여 네이티브 라이브러리 정보를 추출하는 라이브러리 정보 추출 단계; 상기 추출된 네이티브 라이브러리 정보에 포함된 함수를 네이티브 라이브러리에서 호출하는 함수 호출 단계; 상기 호출된 함수 호출 결과를 프로세스간 통신을 이용해 송신하는 호출 결과 송신 단계; 및 상기 송신된 함수 호출 결과를 프로세스간 통신을 이용해 수신하여 상기 자바 애플리케이션으로 전달하는 호출 결과 전달 단계를 포함하는 것을 특징으로 한다.The method according to the second aspect of the present invention includes a call message generating step of generating a native library call message using native library information according to a native library call instruction of a Java application; A call message sending step of sending the generated native library call message using interprocess communication; A library information extraction step of extracting native library information by analyzing the transmitted native library call message; A function call step of calling a function included in the extracted native library information in a native library; A call result sending step of sending the called function call result using interprocess communication; And a call result transferring step of receiving the transmitted function call result using inter-process communication and delivering the result to the Java application.

본 발명은, 자바 애플리케이션의 네이티브 라이브러리 호출 명령에 따라 네이티브 라이브러리 호출 메시지를 생성하여 프로세스간 통신을 통해 송신하고, 송신된 네이티브 라이브러리 호출 메시지를 분석하여 함수를 호출하고, 그 호출된 함수의 호출 결과를 프로세스간 통신을 통해 자바 애플리케이션으로 전달함으로써, 자바 애플리케이션이 플랫폼 또는 가상 머신(VM: Virtual Machine)에 독립적으로 프로세스간 통신을 통해 네이티브 라이브러리의 함수를 호출하여 네이티브 라이브러리의 기능을 활용할 수 있는 효과가 있다.The present invention generates a native library call message according to a native library call command of a Java application and transmits it through interprocess communication, analyzes the transmitted native library call message, calls a function, and reports the result of calling the called function. By passing to a Java application through interprocess communication, a Java application can take advantage of native library functions by calling functions in the native library through interprocess communication independent of the platform or virtual machine (VM). .

또한, 본 발명은 자바 애플리케이션뿐만 아니라 파이썬, 루비, 자바 스크립트 등으로 작성한 애플리케이션에서도 동일한 네이티브 라이브러리의 함수 호출 결과를 이용하여 네이티브 라이브러리의 기능을 활용할 수 있는 효과가 있다.In addition, the present invention has the effect that can utilize the functions of the native library using the result of the function call of the same native library in the application written in Python, Ruby, JavaScript, etc., as well as Java applications.

도 1 은 본 발명에 따른 자바 애플리케이션의 네이티브 라이브러리 호출 장치의 일실시예 구성도,
도 2 는 본 발명에 따른 자바 애플리케이션의 네이티브 라이브러리 호출 장치의 일실시예 흐름도이다.
1 is a configuration diagram of an embodiment of a native library calling device of a Java application according to the present invention;
2 is a flowchart illustrating an embodiment of a native library calling apparatus of a Java application according to the present invention.

이하, 첨부된 도면을 참조하여 본 발명에 따른 실시 예를 상세하게 설명한다. 본 발명의 구성 및 그에 따른 작용 효과는 이하의 상세한 설명을 통해 명확하게 이해될 것이다. 본 발명의 상세한 설명에 앞서, 동일한 구성요소에 대해서는 다른 도면 상에 표시되더라도 가능한 동일한 부호로 표시하며, 공지된 구성에 대해서는 본 발명의 요지를 흐릴 수 있다고 판단되는 경우 구체적인 설명은 생략하기로 함에 유의한다.Hereinafter, embodiments of the present invention will be described in detail with reference to the accompanying drawings. The configuration of the present invention and the operation and effect thereof will be clearly understood through the following detailed description. Prior to the detailed description of the present invention, the same components will be denoted by the same reference numerals even if they are displayed on different drawings, and the detailed description will be omitted when it is determined that the well-known configuration may obscure the gist of the present invention. do.

도 1 은 본 발명에 따른 자바 애플리케이션의 네이티브 라이브러리 호출 장치의 일실시예 구성도이다.1 is a block diagram of an embodiment of a native library calling apparatus of a Java application according to the present invention.

도 1에 도시된 바와 같이, 본 발명에 따른 네이티브 라이브러리 호출 장치(100)는 자바단 호출부(110), 프로세스간 통신부(120) 및 네이티브단 호출부(130)를 포함한다. 여기서, 네이티브 라이브러리 호출 장치(100)는 네이티브 라이브러리(140) 및 자바 애플리케이션(10)과 연결되어 있다.As shown in FIG. 1, the native library calling apparatus 100 according to the present invention includes a Java-end calling unit 110, an inter-process communication unit 120, and a native-end calling unit 130. Here, the native library calling device 100 is connected to the native library 140 and the Java application 10.

본 발명에 따른 네이티브 라이브러리 호출 장치(100)는 자바 애플리케이션(10) 및 네이티브 라이브러리(140) 간의 메시지 릴레이 기능을 수행한다. 네이티브 라이브러리 호출 장치(100)는 플랫폼 독립적이며 언어 독립적으로 네이티브 라이브러리를 이용하기 위하여, 자바 애플리케이션(10)의 호출 명령에 따라 네이티브 라이브러리를 호출할 수 있다. 즉, 네이티브 라이브러리 호출 장치(100)는 JNI, RNI 등의 플랫폼 의존적인 수단을 이용하지 않고, 호출하고자 하는 네이티브 라이브러리(140)를 명시한 네이티브 라이브러리 호출 메시지를 프로세스간 통신을 통해 송수신하고 메시지를 분석해 원하는 라이브러리 함수를 호출하여 함수 호출 결과를 자바 애플리케이션(10)에서 이용할 수 있도록 한다.The native library calling device 100 according to the present invention performs a message relay function between the Java application 10 and the native library 140. The native library calling apparatus 100 may call the native library according to the calling instruction of the Java application 10 in order to use the native library in a platform independent and language independent. That is, the native library calling apparatus 100 transmits and receives a native library call message specifying the native library 140 to be called through inter-process communication and analyzes the message without using platform-dependent means such as JNI and RNI. Calling a library function makes the result of the function call available to the Java application 10.

이하, 본 발명에 따른 네이티브 라이브러리 호출 장치(100)의 구성 요소 각각에 대하여 살펴보기로 한다.Hereinafter, each component of the native library calling apparatus 100 according to the present invention will be described.

자바단 호출부(110)는 자바 애플리케이션(10)의 네이티브 라이브러리 호출 명령에 따라 네이티브 라이브러리 정보를 이용하여 네이티브 라이브러리 호출 메시지를 생성한다. 네이티브 라이브러리 호출 명령은 자바 애플리케이션(10)에서 네이티브 라이브러리(140)의 기능을 이용할 때 발생된다. 여기서, 자바단 호출부(110)는 네이티브 라이브러리 정보로서, 네이티브 라이브러리의 고유 아이디, 호출하고자 하는 함수의 이름 및 파라미터를 이용해 네이티브 라이브러리 호출 메시지를 생성한다. 네이티브 라이브러리 호출 메시지에는 호출하고자 하는 네이티브 라이브러리가 명시되어 있다. 자바단 호출부(110)는 자바로 작성된 클래스로 이루어져 있다. The Java-side calling unit 110 generates a native library call message using the native library information according to the native library call command of the Java application 10. The native library call instruction is generated when using the functions of the native library 140 in the Java application 10. Here, the Java-side calling unit 110 generates a native library call message using native ID information, a unique ID of the native library, a name of a function to be called, and parameters. The native library call message specifies the native library to call. Java-side calling unit 110 is composed of a class written in Java.

그리고 자바단 호출부(110)는 생성된 네이티브 라이브러리 호출 메시지를 프로세스간 통신을 이용해 프로세스간 통신부(120)를 거쳐 네이티브단 호출부(130)로 송신한다. 이후, 자바단 호출부(110)는 송신된 네이티브 라이브러리 호출 메시지에 대한 네이티브 라이브러리 호출 결과를 프로세스간 통신을 이용해 네이티브단 호출부(130)로부터 프로세스간 통신부(120)를 거쳐 수신한다.The Java-end calling unit 110 transmits the generated native library call message to the native-end calling unit 130 via the inter-process communication unit 120 using the inter-process communication. Thereafter, the Java-side caller 110 receives the native library call result for the transmitted native library call message from the native-end caller 130 through the inter-process communication unit 120 using interprocess communication.

네이티브단 호출부(130)는 자바단 호출부(110)로부터 송신된 네이티브 라이브러리 호출 메시지를 수신한다. 그리고 네이티브단 호출부(130)는 네이티브 라이브러리 호출 메시지를 분석하여 네이티브 라이브러리 정보를 추출한다. 네이티브단 호출부(130)는 네이티브 라이브러리 정보로서, 네이티브 라이브러리의 고유 아이디, 호출하고자 하는 함수의 이름 및 파라미터를 추출한다. 이어서, 네이티브단 호출부(130)는 추출된 네이티브 라이브러리 정보에 포함된 함수를 네이티브 라이브러리에서 호출한다.The native end caller 130 receives a native library call message transmitted from the Java end caller 110. The native end calling unit 130 analyzes the native library call message and extracts native library information. The native end calling unit 130 extracts unique IDs of native libraries, names of functions to be called, and parameters as native library information. Subsequently, the native calling unit 130 calls a function included in the extracted native library information from the native library.

함수 호출 과정을 구체적으로 살펴보면, 네이티브단 호출부(130)는 추출된 네이티브 라이브러리 정보 중에서 네이티브 라이브러리의 고유 아이디를 기초로 하여 해당 네이티브 라이브러리를 찾아 메모리에 로드한다. 그리고 네이티브단 호출부(130)는 중앙처리장치의 레지스터 및 스택을 조작해 파라미터를 설정하여 함수의 이름에 해당하는 함수를 메모리에 로드된 네이티브 라이브러리에서 호출한다. 자바 애플리케이션(10)은 라이브러리의 특정 함수를 호출할 것인 미리 알고 있다. 하지만, 네이티브단 호출부(130)는 함수의 종류와 시그니처에 상관없이 함수를 호출해야 한다. 따라서 네이티브단 호출부(130)는 임의의 시그니처를 갖는 함수를 호출하기 위해, 임의의 파라미터를 호출된 함수로 전달하기 위해 스택과 CPU 레지스터를 조작할 수 있다. 여기서, CPU 아키텍처별로 함수 호출시 이용되는 CPU 레지스터의 수와 스택 설정은 상이할 수 있다.Looking at the function call process in detail, the native end calling unit 130 finds the corresponding native library based on the unique ID of the native library from the extracted native library information and loads it into memory. The native end calling unit 130 sets a parameter by manipulating a register and a stack of the central processing unit to call a function corresponding to the name of the function from a native library loaded in memory. The Java application 10 knows in advance that it will call certain functions of the library. However, the native calling unit 130 should call the function regardless of the type and signature of the function. Accordingly, the native calling unit 130 may manipulate the stack and the CPU register to pass arbitrary parameters to the called function to call a function having an arbitrary signature. Here, the number of CPU registers and the stack setting used in the function call for each CPU architecture may be different.

이후, 네이티브단 호출부(130)는 호출된 함수 호출 결과를 자바단 호출부(110)로 프로세스간 통신을 이용해 프로세스간 통신부(120)를 거쳐 자바단 호출부(110)로 송신한다.Thereafter, the native end calling unit 130 transmits the called function call result to the Java end calling unit 110 through the inter-process communication unit 120 using the inter-process communication to the Java end calling unit 110.

프로세스간 통신부(120)는 자바단 호출부(110)와 네이티브단 호출부(130) 간의 송수신을 프로세스간 통신(IPC: Inter-Process Communication)을 이용해 수행한다. 프로세스간 통신부(120)는 메시지 큐, 공유 메모리, 소켓, 파이프, 디-버스(D-BUS) 중 적어도 하나를 이용하여 자바단 호출부(110)와 네이티브단 호출부(130) 간의 프로스세간 통신을 수행할 수 있다. 또한, 프로세스간 통신부(120)는 운영체제 및 플랫폼에서 제공하는 다른 프로세스간 통신을 이용해 자바단 호출부(110)와 네이티브단 호출부(130) 간의 프로스세간 통신을 수행할 수 있다.The inter-process communication unit 120 performs transmission and reception between the Java-side caller 110 and the native-side caller 130 using inter-process communication (IPC). The inter-process communication unit 120 may process the communication between the Java caller 110 and the native caller 130 using at least one of a message queue, a shared memory, a socket, a pipe, and a D-BUS. Can be performed. In addition, the interprocess communication unit 120 may perform process interprocess communication between the Java-end calling unit 110 and the native-end calling unit 130 using other inter-process communication provided by the operating system and the platform.

도 2 는 본 발명에 따른 자바 애플리케이션의 네이티브 라이브러리 호출 장치의 일실시예 흐름도이다.2 is a flowchart illustrating an embodiment of a native library calling apparatus of a Java application according to the present invention.

자바단 호출부(110)는 자바 애플리케이션(10)으로부터 네이티브 라이브러리에 대한 호출 명령을 수신한다(S202).The Java terminal call unit 110 receives a call command for a native library from the Java application 10 (S202).

그리고 자바단 호출부(110)는 수신된 호출 명령에 해당하는 네이티브 라이브러리에 대한 네이티브 라이브러리 정보를 이용해 네이티브 라이브러리 호출 메시지를 생성한다(S204). 여기서, 네이티브 라이브러리 정보에는 고유 아이디, 호출하고자 하는 함수의 이름 및 파라미터가 포함된다.The Java-side calling unit 110 generates a native library call message using native library information on the native library corresponding to the received call command (S204). Here, the native library information includes a unique ID, a name of a function to be called, and a parameter.

이어서, 자바단 호출부(110)는 생성된 네이티브 라이브러리 호출 메시지를 프로세스간 통신을 이용해 프로세스간 통신부(120)를 거쳐 네이티브단 호출부(130)로 송신한다(S206). 여기서, 프로세스간 통신부(120)는 메시지 큐, 공유 메모리, 소켓, 파이프, 디-버스(D-BUS) 중 적어도 하나를 이용하여 프로스세간 통신을 수행할 수 있다. 또한, 프로세스간 통신부(120)는 운영체제 및 플랫폼에서 제공하는 다른 프로세스간 통신을 이용해 프로스세간 통신을 수행할 수 있다.Subsequently, the Java-end calling unit 110 transmits the generated native library call message to the native-end calling unit 130 via the inter-process communication unit 120 using the inter-process communication (S206). Here, the interprocess communication unit 120 may perform interprocess communication using at least one of a message queue, a shared memory, a socket, a pipe, and a D-BUS. In addition, the interprocess communication unit 120 may perform interprocess communication using other interprocess communication provided by an operating system and a platform.

네이티브단 호출부(130)는 자바단 호출부(110)로부터 프로세스간 통신부(120)를 거쳐 수신된 네이티브 라이브러리 호출 메시지를 수신한다(S208).The native caller 130 receives a native library call message received from the Java caller 110 via the interprocess communication unit 120 (S208).

그리고 네이티브단 호출부(130)는 프로세스간 통신부(120)를 거쳐 수신된 네이티브 라이브러리 호출 메시지를 분석해 네이티브 라이브러리 호출 메시지를 분석하여 네이티브 라이브러리 정보를 추출한다(S210). 여기서, 네이티브 라이브러리 정보에는 고유 아이디, 호출하고자 하는 함수의 이름 및 파라미터가 포함된다.The native end calling unit 130 analyzes the native library call message received through the interprocess communication unit 120 to analyze the native library call message and extracts native library information (S210). Here, the native library information includes a unique ID, a name of a function to be called, and a parameter.

이어서, 네이티브단 호출부(130)는 추출된 네이티브 라이브러리 정보 중에서 네이티브 라이브러리의 고유 아이디를 기초로 하여 해당 네이티브 라이브러리를 찾아 메모리에 로드한다(S212).Subsequently, the native end calling unit 130 finds the corresponding native library based on the unique ID of the native library among the extracted native library information, and loads it into the memory (S212).

그리고 네이티브단 호출부(130)는 중앙처리장치(CPU)의 레지스터 및 스택을 조작해 파라미터를 설정하여 "S210" 과정에서 추출된 함수의 이름에 해당하는 함수를 메모리에 로드된 네이티브 라이브러리에서 호출한다(S214).In addition, the native calling unit 130 operates a register and a stack of the CPU to set parameters to call a function corresponding to the name of the function extracted in step S210 from the native library loaded in the memory. (S214).

이후, 네이티브단 호출부(130)는 호출된 함수 호출 결과를 프로세스간 통신을 이용해 프로세스간 통신부(120)로 거쳐 네이티브단 호출부(130)로 송신한다(S216).Thereafter, the native end calling unit 130 transmits the called function call result to the native end calling unit 130 via the inter-process communication unit 120 using the inter-process communication (S216).

자바단 호출부(110)는 네이티브단 호출부(130)로부터 프로세스간 통신부(120)를 거쳐 함수 호출 결과를 수신한다(S218).The Java terminal caller 110 receives a function call result from the native caller 130 via the inter-process communication unit 120 (S218).

자바단 호출부(110)는 함수 호출 결과를 자바 애플리케이션(10)으로 전달하여 자바 애플리케이션(10)에서 함수 호출 결과가 활용된다(S220).The Java terminal call unit 110 transfers the function call result to the Java application 10 to utilize the function call result in the Java application 10 (S220).

한편, 본 발명은 이상에서 설명한 자바 애플리케이션의 네이티브 라이브러리 호출 방법을 소프트웨어적인 프로그램으로 구현하여 컴퓨터로 읽을 수 있는 소정 기록 매체에 기록해 둠으로써 다양한 재생 장치에 적용할 수 있다. Meanwhile, the present invention can be applied to various reproduction apparatuses by implementing the native library calling method of the Java application described above as a software program and recording the same on a computer-readable predetermined recording medium.

다양한 재생 장치는 앞서 설명한 사용자 단말로서 이동 단말기, PDA, 노트북, 네비게이션, PMP, 스마트폰, 전자사전 및 MPS 등일 수 있다. Various reproducing apparatuses may be mobile terminals, PDAs, notebook computers, navigation systems, PMPs, smart phones, electronic dictionaries, MPSs, and the like as the user terminals described above.

예컨대, 기록 매체는 각 재생 장치의 내장형으로 하드 디스크, 플래시 메모리, RAM, ROM 등이거나, 외장형으로 CD-R, CD-RW와 같은 광디스크, 콤팩트 플래시 카드, 스마트 미디어, 메모리 스틱, 멀티미디어 카드일 수 있다. For example, the recording medium may be a hard disk, a flash memory, a RAM, a ROM, or the like as an internal type of each playback device, or an optical disc such as a CD-R or a CD-RW, a compact flash card, a smart media, a memory stick, or a multimedia card as an external type. have.

이 경우, 컴퓨터로 읽을 수 있는 기록 매체에 기록한 프로그램은, 자바 애플리케이션의 네이티브 라이브러리 호출 명령에 따라 네이티브 라이브러리 정보를 이용하여 네이티브 라이브러리 호출 메시지를 생성하는 호출 메시지 생성 과정, 상기 생성된 네이티브 라이브러리 호출 메시지를 프로세스간 통신을 이용해 송신하는 호출 메시지 송신 과정, 상기 송신된 네이티브 라이브러리 호출 메시지를 분석하여 네이티브 라이브러리 정보를 추출하는 라이브러리 정보 추출 과정, 상기 추출된 네이티브 라이브러리 정보에 포함된 함수를 네이티브 라이브러리에서 호출하는 함수 호출 과정, 상기 호출된 함수 호출 결과를 프로세스간 통신을 이용해 송신하는 호출 결과 송신 과정 및 상기 송신된 함수 호출 결과를 프로세스간 통신을 이용해 수신하여 상기 자바 애플리케이션으로 전달하는 호출 결과 전달 과정을 포함하여 실행될 수 있다.In this case, a program recorded on a computer-readable recording medium may generate a call message process of generating a native library call message using native library information according to a native library call command of a Java application, and generating the generated native library call message. A process of transmitting a call message by using interprocess communication, a process of extracting library information by analyzing the transmitted native library call message, and a function of calling a function included in the extracted native library information in a native library A call result, a call result transmitting step of transmitting the called function call result using interprocess communication, and the received function call result using the interprocess communication Results invoked to transfer the application can be carried out, including the delivery process.

이상의 설명은 본 발명을 예시적으로 설명한 것에 불과하며, 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자에 의해 본 발명의 기술적 사상에서 벗어나지 않는 범위에서 다양한 변형이 가능할 것이다. 따라서 본 발명의 명세서에 개시된 실시 예들은 본 발명을 한정하는 것이 아니다. 본 발명의 범위는 아래의 특허청구범위에 의해 해석되어야 하며, 그와 균등한 범위 내에 있는 모든 기술도 본 발명의 범위에 포함되는 것으로 해석해야 할 것이다.The foregoing description is merely illustrative of the present invention, and various modifications may be made by those skilled in the art without departing from the spirit of the present invention. Accordingly, the embodiments disclosed in the specification of the present invention are not intended to limit the present invention. The scope of the present invention should be construed according to the following claims, and all the techniques within the scope of equivalents should be construed as being included in the scope of the present invention.

본 발명은 자바 애플리케이션의 네이티브 라이브러리 호출 명령에 따라 네이티브 라이브러리 호출 메시지를 생성하여 프로세스간 통신을 통해 송신하고, 송신된 네이티브 라이브러리 호출 메시지를 분석하여 함수를 호출하고, 그 호출된 함수의 호출 결과를 프로세스간 통신을 통해 자바 애플리케이션으로 전달함으로써, 자바 애플리케이션이 플랫폼 또는 가상 머신(VM: Virtual Machine)에 독립적으로 프로세스간 통신을 통해 네이티브 라이브러리의 함수를 호출하여 네이티브 라이브러리의 기능을 활용할 수 있다. 이러한 점에서 기존 기술의 한계를 뛰어 넘음에 따라 관련 기술에 대한 이용만이 아닌 적용되는 장치의 시판 또는 영업의 가능성이 충분할 뿐만 아니라 현실적으로 명백하게 실시할 수 있는 정도이므로 산업상 이용 가능성이 있는 발명이다.The present invention generates a native library call message according to a native library call command of a Java application and transmits it through interprocess communication, analyzes the transmitted native library call message, calls a function, and processes the result of calling the called function. By passing it to a Java application through inter-communication, the Java application can take advantage of the native library's functionality by calling functions in the native library through inter-process communication independent of the platform or virtual machine (VM). In this respect, the invention is a commercially available invention because the possibility of marketing or operating the applied device is not only sufficient for the use of the related technology, but also practically evident as it exceeds the limitation of the existing technology.

10: 자바 애플리케이션 100: 네이티브 라이브러리 호출 장치
110: 자바단 호출부 120: 프로세스간 통신부
130: 네이티브단 호출부 140: 네이티브 라이브러리
10: Java Application 100: Native Library Calling Device
110: java caller 120: interprocess communication unit
130: native calling unit 140: native library

Claims (13)

자바 애플리케이션의 네이티브 라이브러리 호출 명령에 따라 네이티브 라이브러리 정보를 이용하여 네이티브 라이브러리 호출 메시지를 생성하여 프로세스간 통신을 이용해 송신하고, 상기 송신된 네이티브 라이브러리 호출 메시지에 대한 네이티브 라이브러리 호출 결과를 프로세스간 통신을 이용해 수신하여 상기 자바 애플리케이션으로 전달하는 자바단 호출부;
상기 송신된 네이티브 라이브러리 호출 메시지를 분석하여 네이티브 라이브러리 정보를 추출하고, 상기 추출된 네이티브 라이브러리 정보에 포함된 함수를 네이티브 라이브러리에서 호출하여 함수 호출 결과를 상기 자바단 호출부로 프로세스간 통신을 이용해 송신하는 네이티브단 호출부; 및
상기 자바단 호출부와 상기 네이티브단 호출부 간의 송수신을 프로세스간 통신을 이용해 수행하는 프로세스간 통신부
를 포함하는 자바 애플리케이션의 네이티브 라이브러리 호출 장치.
According to a native library call command of a Java application, a native library call message is generated using native library information and transmitted using interprocess communication, and a native library call result for the transmitted native library call message is received using interprocess communication. Java stage caller for transmitting to the Java application;
The native library information is extracted by analyzing the transmitted native library call message, and a native that calls a function included in the extracted native library information in a native library and transmits a function call result to the Java calling page using inter-process communication. Only call; And
Inter-process communication unit for performing transmission and reception between the Java-end caller and the native caller using inter-process communication
Native library calling device of the Java application including a.
제 1 항에 있어서,
상기 자바단 호출부는,
상기 네이티브 라이브러리 정보로서, 상기 네이티브 라이브러리의 고유 아이디, 호출하고자 하는 함수의 이름 및 파라미터를 이용해 네이티브 라이브러리 호출 메시지를 생성하는 것을 특징으로 하는 자바 애플리케이션의 네이티브 라이브러리 호출 장치.
The method of claim 1,
The Java end call unit,
The native library calling device of the Java application, characterized in that for generating the native library call message using the unique ID, the name of the function to be called and parameters of the native library as the native library information.
제 1 항에 있어서,
상기 네이티브단 호출부는,
상기 네이티브 라이브러리 정보로서, 상기 네이티브 라이브러리의 고유 아이디, 호출하고자 하는 함수의 이름 및 파라미터를 추출하고, 상기 추출된 네이티브 라이브러리 정보 중에서 네이티브 라이브러리의 고유 아이디를 기초로 하여 해당 네이티브 라이브러리를 찾아 메모리에 로드하는 것을 특징으로 하는 자바 애플리케이션의 네이티브 라이브러리 호출 장치.
The method of claim 1,
The native end call unit,
As the native library information, a unique ID of the native library, a name of a function to be called and a parameter are extracted, and a corresponding native library is found and loaded into memory based on the unique ID of the native library among the extracted native library information. A native library calling device for a Java application, characterized in that.
제 3 항에 있어서,
상기 네이티브단 호출부는,
중앙처리장치의 레지스터 및 스택을 조작해 파라미터를 설정하여 상기 추출된 함수의 이름에 해당하는 함수를 상기 로드된 네이티브 라이브러리에서 호출하는 것을 특징으로 하는 자바 애플리케이션의 네이티브 라이브러리 호출 장치.
The method of claim 3, wherein
The native end call unit,
And setting a parameter by manipulating a register and a stack of a central processing unit to call a function corresponding to the name of the extracted function from the loaded native library.
제 1 항에 있어서,
상기 프로세스간 통신부는,
메시지 큐, 공유 메모리, 소켓, 파이프, 디-버스(D-BUS) 중 적어도 하나를 이용하여 상기 자바단 호출부와 상기 네이티브단 호출부 간의 프로스세간 통신을 수행하는 것을 특징으로 하는 자바 애플리케이션의 네이티브 라이브러리 호출 장치.
The method of claim 1,
The inter-process communication unit,
Native of a Java application, which performs process communication between the Java caller and the native caller using at least one of a message queue, a shared memory, a socket, a pipe, and a D-BUS. Library call device.
제 1 항에 있어서,
상기 프로세스간 통신부는,
운영체제 및 플랫폼에서 제공하는 다른 프로세스간 통신을 이용해 상기 자바단 호출부와 상기 네이티브단 호출부 간의 프로스세간 통신을 수행하는 것을 특징으로 하는 자바 애플리케이션의 네이티브 라이브러리 호출 장치.
The method of claim 1,
The inter-process communication unit,
The native library calling device of the Java application, characterized in that for performing process communication between the Java-end caller and the native-end caller using other inter-process communication provided by an operating system and a platform.
자바 애플리케이션의 네이티브 라이브러리 호출 명령에 따라 네이티브 라이브러리 정보를 이용하여 네이티브 라이브러리 호출 메시지를 생성하는 호출 메시지 생성 단계;
상기 생성된 네이티브 라이브러리 호출 메시지를 프로세스간 통신을 이용해 송신하는 호출 메시지 송신 단계;
상기 송신된 네이티브 라이브러리 호출 메시지를 분석하여 네이티브 라이브러리 정보를 추출하는 라이브러리 정보 추출 단계;
상기 추출된 네이티브 라이브러리 정보에 포함된 함수를 네이티브 라이브러리에서 호출하는 함수 호출 단계;
상기 호출된 함수 호출 결과를 프로세스간 통신을 이용해 송신하는 호출 결과 송신 단계; 및
상기 송신된 함수 호출 결과를 프로세스간 통신을 이용해 수신하여 상기 자바 애플리케이션으로 전달하는 호출 결과 전달 단계
를 포함하는 자바 애플리케이션의 네이티브 라이브러리 호출 방법.
A call message generation step of generating a native library call message using native library information according to a native library call instruction of a Java application;
A call message sending step of sending the generated native library call message using interprocess communication;
A library information extraction step of extracting native library information by analyzing the transmitted native library call message;
A function call step of calling a function included in the extracted native library information in a native library;
A call result sending step of sending the called function call result using interprocess communication; And
Call result delivery step of receiving the transmitted function call result using the inter-process communication to deliver to the Java application
Native library call method of the Java application including.
제 7 항에 있어서,
상기 호출 메시지 생성 단계는,
상기 네이티브 라이브러리 정보로서, 상기 네이티브 라이브러리의 고유 아이디, 호출하고자 하는 함수의 이름 및 파라미터를 이용해 네이티브 라이브러리 호출 메시지를 생성하는 것을 특징으로 하는 자바 애플리케이션의 네이티브 라이브러리 호출 방법.
The method of claim 7, wherein
The call message generation step,
The native library calling method of the Java application, characterized in that for generating the native library call message using the unique ID of the native library, the name of the function to be called and parameters as the native library information.
제 7 항에 있어서,
상기 라이브러리 정보 추출 단계는,
상기 네이티브 라이브러리 정보로서, 상기 네이티브 라이브러리의 고유 아이디, 호출하고자 하는 함수의 이름 및 파라미터를 추출하는 것을 특징으로 하는 자바 애플리케이션의 네이티브 라이브러리 호출 방법.
The method of claim 7, wherein
The library information extraction step,
And extracting a unique ID of the native library, a name of a function to be called, and a parameter as the native library information.
제 9 항에 있어서,
상기 함수 호출 단계는,
상기 추출된 네이티브 라이브러리 정보 중에서 네이티브 라이브러리의 고유 아이디를 기초로 하여 해당 네이티브 라이브러리를 찾아 메모리에 로드하는 것을 특징으로 하는 자바 애플리케이션의 네이티브 라이브러리 호출 방법.
The method of claim 9,
The function call step,
A method of calling a native library of a Java application, characterized in that for finding and loading a corresponding native library into a memory based on a unique ID of the native library among the extracted native library information.
제 9 항에 있어서,
상기 함수 호출 단계는,
중앙처리장치의 레지스터 및 스택을 조작해 파라미터를 설정하여 상기 추출된 함수의 이름에 해당하는 함수를 상기 로드된 네이티브 라이브러리에서 호출하는 것을 특징으로 하는 자바 애플리케이션의 네이티브 라이브러리 호출 방법.
The method of claim 9,
The function call step,
And calling a function corresponding to the name of the extracted function from the loaded native library by manipulating a register and a stack of a central processing unit to set parameters.
제 7 항에 있어서,
상기 호출 메시지 송신 단계 및 상기 호출 결과 송신 단계는,
메시지 큐, 공유 메모리, 소켓, 파이프, 디-버스(D-BUS) 중 적어도 하나를 이용하여 상기 프로스세간 통신을 수행하는 것을 특징으로 하는 자바 애플리케이션의 네이티브 라이브러리 호출 방법.
The method of claim 7, wherein
The call message transmission step and the call result transmission step,
A method for calling a native library of a Java application, characterized in that for performing the process communication using at least one of a message queue, a shared memory, a socket, a pipe, and a D-BUS.
제 7 항에 있어서,
상기 호출 메시지 송신 단계 및 상기 호출 결과 송신 단계는,
운영체제 및 플랫폼에서 제공하는 다른 프로세스간 통신을 이용해 상기 프로스세간 통신을 수행하는 것을 특징으로 하는 자바 애플리케이션의 네이티브 라이브러리 호출 방법.
The method of claim 7, wherein
The call message transmission step and the call result transmission step,
A method for calling a native library of a Java application, characterized in that for performing interprocess communication using another interprocess communication provided by an operating system and a platform.
KR1020100133899A 2010-12-23 2010-12-23 Apparatus and method for invoking native libraries by java application KR20120072105A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020100133899A KR20120072105A (en) 2010-12-23 2010-12-23 Apparatus and method for invoking native libraries by java application

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020100133899A KR20120072105A (en) 2010-12-23 2010-12-23 Apparatus and method for invoking native libraries by java application

Publications (1)

Publication Number Publication Date
KR20120072105A true KR20120072105A (en) 2012-07-03

Family

ID=46706926

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020100133899A KR20120072105A (en) 2010-12-23 2010-12-23 Apparatus and method for invoking native libraries by java application

Country Status (1)

Country Link
KR (1) KR20120072105A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101963051B1 (en) * 2017-12-06 2019-03-27 고려대학교 산학협력단 Terminal device for executing Java-based application program and Method for controlling the same

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101963051B1 (en) * 2017-12-06 2019-03-27 고려대학교 산학협력단 Terminal device for executing Java-based application program and Method for controlling the same

Similar Documents

Publication Publication Date Title
US10846101B2 (en) Method and system for starting up application
KR20170094136A (en) System and method for execution of application code compiled according to two instruction set architectures
US11726799B2 (en) Preventing framework conflicts for multi-OS applications
US10380329B2 (en) Method and apparatus for preventing application from being deciphered
KR101394780B1 (en) Isa bridging including support for call to overidding virtual functions
KR102028091B1 (en) Apparatus and method for loading up dex file into memory
US20220405385A1 (en) Secure container construction device and method executable by android application, and computer-readable recording medium on which program thereof is recorded
CN103885814A (en) Simulator device and method for operating ARM APKs on x86 framework
WO2020177429A1 (en) Method and apparatus for embedding codes in application, and electronic device
CN112817657B (en) Application program starting item loading method, device, system and storage medium
CN111506368B (en) Method, device, equipment and storage medium for converting asynchronous call into synchronous call
CN113946602A (en) Data searching method, device, equipment and medium
US20180218154A1 (en) Analysis device, analysis method, and analysis program
EP3797356B1 (en) Code base sharing between standalone and web-based versions of an application due to the implementing of an emulated network communication channel
KR101117165B1 (en) Web platform unit for mobile terminal connectioned web-application program in heterogeneous operating system
CN113419712A (en) Cross-platform application generation method, cross-platform application calling method and development device
CN110018831B (en) Program processing method, program processing apparatus, and computer-readable storage medium
KR20120072105A (en) Apparatus and method for invoking native libraries by java application
CN112162755B (en) Data processing method, device, medium and electronic equipment
CN107450946B (en) Chrome webpage and terminal software communication method, equipment and storage medium
CN112612474A (en) Product transplanting method and device, storage medium and electronic equipment
CN111782196A (en) MVP architecture-based development method and device
KR20090122703A (en) Server and method for providing converting contents
US11354433B1 (en) Dynamic taint tracking on mobile devices
CN113504936B (en) Software version release method, computer device and storage medium

Legal Events

Date Code Title Description
WITN Withdrawal due to no request for examination