<div class="gmail_quote">On Fri, Oct 12, 2012 at 9:23 AM, Michael Truog <span dir="ltr"><<a href="mailto:mjtruog@gmail.com" target="_blank">mjtruog@gmail.com</a>></span> wrote:<br><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#ffffff" text="#000000"><div><div>There are 4 main ways to integrate Erlang and C/C++ source code:<br></div></div>
- NIF<br>
- port driver<br>
- port<br>
- cnode<br>
<br></div></blockquote><div><br>Thanks thats a good set of starting points<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#ffffff" text="#000000">
The NIF and port driver approach can expose the Erlang VM to any
memory problems the C code creates, though it is the most
efficient. Usually legacy C or C++ code is best integrated with a
port, which is ran as a separate OS process communicating with
pipes. I have an open source project here: <a href="http://cloudi.org" target="_blank">http://cloudi.org</a>, which
can simplify this integration and also provide natural scalability
for your legacy source code …</div></blockquote><div><br>Great! I dont yet know our project or Erlang well enough; yet I expect that this will be a help<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div bgcolor="#ffffff" text="#000000">if: you use the CloudI API (in this
case, in C or C++) to communicate with an Erlang CloudI service that
handles your external communication that needs to scale. Then you
can easily migrate parts of your system, or the whole system, over
to Erlang, which will naturally improve your testing, debugging,
scalability, reliability, concurrency and the source code size. The
integration is similar to integrating with an Erlang port, but it
provides features that prevent integration problems, like:<br>
- stdout/stderr handling<br>
- automatic OS process failure handling (similar to supervisor
restarts)<br>
- request UUIDs<br>
- requests as transactions (i.e., each request receives a response
asynchronously)<br>
- timeouts are enforced for soft-realtime constraints on the
external software<br>
- native language integration (both C and C++ have separate
interfaces which provide the CloudI API)<br>
<br>
As with all open source projects, it needs more documentation, but
tell me if you have any questions.<br>
<br></div></blockquote><div><br>As we start making headway I would be happy to contribute patches to docs.<br>Maybe even code but I am some way off yet :-) <br></div></div><br>Rusi<br clear="all"><br>-- <br><br>
<a href="http://blog.languager.org" target="_blank">http://blog.languager.org</a><br><br><br>