Java and C/C++ Mixed Programming

자바와 C/C++의 혼합 프로그래밍

  • Received : 2010.07.20
  • Accepted : 2010.09.17
  • Published : 2010.10.30

Abstract

The standard Java class library does not support the platform-dependent features needed by the application. Therefore, the Java application including the platform -dependent features must supplement the required features by invoking native functions using JNI. The native language programmer has to explicitly specify how to connect to various Java objects and later to disconnect from them. In this paper, I suggest a way to avoid these annoying works. The native method in the pure java class can not contain a native code block. By providing a native code block for the native method, it is possible for programmer to write a native code without being aware of JNI. To achieve this, I introduced the native class that is a java class on the native environment, and made it possible to interchange data by placing an arbitrator between the java class and the native class.

표준 자바 클래스 라이브러리는 용용 프로그램에 의해 요구되는 플랫폼 의존적인 기능을 수행하지 못한다. 따라서 플랫폼 의존적인 기능을 포함한 자바 응용 프로그램은 JNI를 사용한 네이티브 함수를 호출하여 부족한 기능을 수행하여야 한다. 네이티브 언어 프로그래머는 다양한 자바 객체와 연결하고 사용 후 이를 해지해야하는 작업을 명시적으로 기술해야 한다. 이러한 번거로운 작업을 피하기 위한 방법을 본 논문에서 제안하고자 한다. 순수 자바 클래스에서 네이티브 메소드는 코드 블록을 가질 수 없다. 자바 네이티브 메소드가 네이티브 코드로 작성된 몸채를 가질 수 있도록 함으로써 프로그래머는 JNI를 의식하지 않고 프로그래밍하는 것이 가능하다. 이를 위해 네이티브 환경의 자바 클래스인 네이티브 클래스라는 개념, 그리고 자바 클래스와 네이티브 클래스 간에 제어와 자료의 교환을 지원하는 중재기를 두어 해결하였다.

Keywords

References

  1. Ken Arnold, James Gosling and David Holmes, The Java Programming Language, 4th Edition, Addition Wesley, 2005.
  2. Java Native Interface Specification. http://java.sun.com/javase/6/docs/technotes/guides/jni/spec/jniTOC.html.
  3. Sheng Liang, The Java Native Interface: Programmer's Guide and Specification, Addition Wesley, 1999.
  4. Tim Lindholm and Frank Yellin, The Java Virtual Machine Specification, 2nd Edition, Addison Wesley, 1999.
  5. GlueGen, https//gluegen.dev.java.net
  6. HawtJNI, http://fusesource.org/forge/projects/HA WTJNI.
  7. JNA, http://jna.dev.java.net.
  8. Evgeniy Gabrilovich and Lev Finkelstein, "JNI-C++ integration made easy," C/C++ Users Journal, Vol.19, No.1, pp. 10-21, 2001.
  9. JavaCC, https://javacc.dev.java.net.
  10. Viswanathan Kodaganallur, "Incorporating Language Processing into Java Applications: A JavaCC Tutorial," IEEE Software, Vol.21, No.4, pp. 70-77, 2004.
  11. BCEL, http://jakarta.apache.org/bcel.