Language Bindings for Erlang
Christian S
chsu79@REDACTED
Mon May 22 15:04:31 CEST 2006
On 5/22/06, Jeff Crane <jefcrane@REDACTED> wrote:
>
> I am looking to build my client GUI. I would like to
> use, in order of preference:
>
> HGE (C++ library)
> Python
> ESDL
> HGE through EPI?
> (http://epi.sourceforge.net/docs-0.0.2/index.html)
> EPI (Erlang Plus Interface) is in the Erlang FAQ.
>
> Is there a way to inline C++ or Python calls in
> Erlang? It makes it trivial to have 1 process that's
> waiting and acting on server messages locally instead
> of having to worry about message sending to ANOTHER
> (GUI) process, complicating synchronization
> unnecessarily.
>
>
I find that inline drivers are too complex to bother with when
there is the simpler alternative of having a separate process
running the foreign code. Especially when prototyping something,
something that doesnt desperatly need to run in the same process.
I dont see how synchronization is a problem, as you can easily make
calls to HGC sequential using an erlang gen_server the interface for
your erlang code. And group several operations inside a anonymous
function, similar to mnesia:transaction/1.
So the approach I would use is to write a C++ program that reads
easily parsed instructions on stdin and writes events from input and
other things to stdout. From erlang you can then create a port that
starts this program, and you can communicate with it through the port.
Make a gen_server own the port and turn erlang terms into the "wire"
protocol.
If this all seems too laborous to you, perhaps you could look at wings3d
which is a successful application that use foreign code libs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20060522/c65fe54a/attachment.htm>
More information about the erlang-questions
mailing list