Search Results for 'ffi'

2 POSTS

  1. 2007.08.07 Using Haskell from Python with ctypes
  2. 2007.05.18 마소 6월 원고: FFI 2

Using Haskell from Python with ctypes

Posted 2007. 8. 7. 03:01
Recently, I am trying to make it possible to write Chameleo plugins in Haskell. Chameleo is wirtten mostly in Python and there is no direct method to call Haskell functions in Python. However, Python is the most powerful glue language in the world(Okay, maybe next to Perl), it is not hard to use both Haskell and Python at the same time within an application. PythonVsHaskell shows an example which compiles the Haskell code with ghc and generates a dll file. Python ctypes can call these functions in the DLL as if they are normal C functions.

MissingPy seems to be another option for calling Python code from Haskell (but not calling Haskell code from Python). The recent version is 0.8.9, but it seems to be still in beta quality.

마소 6월 원고: FFI

Posted 2007. 5. 18. 21:51
오늘 마소 6월 원고를 마감했습니다. 지난 달 원고 쓴지 얼마 안 된 것 같은데 원고 마감은 왜 이렇게 빨리 돌아오는지! 이번달 주제는 외부 함수 인터페이스로 정했습니다. 자바에서 C를 부르고, 파이썬에서 C를 부르고 하는 것들을 말합니다.

외부 함수 인터페이스(FFI, Foreign Function Interface)

근래의 소프트웨어들을 살펴보면, 보통 한 가지 이상의 언어로 작성됨을 알 수 있다. 복잡한 프로그램의 요구 사항을 만족시키기 위해 여러 프로그래밍 언어의 장점만을 취하려는 전략이다. 대표적인 예가 주 개발은 자바로 하고, 성능이 필수적인 일부 모듈만 C 언어로 작성하는 것이다. 자바 언어의 안정성과 방대한 라이브러리를 취하면서, 동시에 C의 높은 성능을 얻을 수 있기 때문이다. 자바와 C를 연결하기 위해 사용하는 인터페이스는 JNI(Java Native Interface)라 불리는데, 자바뿐만 아니라 대부분의 언어들이 외부 함수를 호출할 수 있는 인터페이스(FFI, Foreign Function Interface)를 제공하고 있다. 이 글에서는 자바(JNI)와 파이썬(Python/C API)을 통해 FFI의 개념과 사용 방법을 살펴보자.


자세한 내용은 6월호가 나오면 보실 수 있습니다.