[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Visionaries] The DG-Scheme Foreign Language Interface

From: Peter Minten
Subject: [Visionaries] The DG-Scheme Foreign Language Interface
Date: Fri, 15 Aug 2003 09:11:26 +0200
User-agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.4) Gecko/20030529

Hi folks,

I've found a way to build the Foreign Language Interface without depending on the FLI interface of the language the interpreter is written in. Here's a diagram:

+---------------------+          +------------------------+
|     FLI wrapper     |   pipe   |    DGS interpreter     |
|  +---------------+  | <------> |  +------------------+  |
|  |  foreign lib  |  |          |  |  DG-Scheme code  |  |
|  +---------------+  |          |  +------------------+  |
+---------------------+          +------------------------+

The FLI wrapper is a separate process and writen in an appropriate language for calling the foreign lib. The FLI wrapper loads the foreign lib. When the DGS interpreter, at the command of the DGS code, send a function call the FLI wrapper reads it and calls the right function. Then the FLI wrapper sends back the result.

The protocol used is a custom binary DG-Scheme FLI protocol. Since binary protocols are fast and this protocol is not meant to be used for anything else than DG-Scheme FLI I consider it the best option.

The protocol is pretty advanced, supporting stuff like objects. However it's DGS-centric, the FLI wrapper translates the DGS into the foreign language and back.

The advantage of this scheme is that I can basically call any language with one FLI protocol, all you need is a FLI wrapper for the language you want to call.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]