C interface example

Torbjorn Tornkvist tobbe@REDACTED
Thu Oct 7 06:17:50 CEST 1999

> Now I like the simplicity and elegance of your syntax
> but it forces me to know the node that the process runs on.
> Why would this be?

Well, here is the possible scenarios:

 1. The part of your application which is written in C
    take contact with the Erlang part. 

 2. The part of your application which is written in Erlang
    take contact with the C part. 

In both cases you have to send messages to a registered 
process since you (initially) don't know any PIDs. This is 
for example what erl_rpc()/rpc:call() does (it calls the 
'rex' process). You also have to know which Erlang node 
you want to talk with since you may have several Erlang 
nodes running on the same host.

NB: Using the erl_interface library for communication means
that you talk the Erlang distribution protocol. However, the
C part won't show up in the result from the nodes/0 BIF (the
C-node is said to be a hidden node). This is because some of
the Erlang libraries, which implements varius distributed 
features, relies in being able to talk to all connected nodes. 
A C-node doesn't (and shouldn't) have to implement all those 
features, thus it won't show up in the result from nodes/0.

Cheers /Tobbe

More information about the erlang-questions mailing list