franklinexpress
franklinexpress

Reputation: 1189

Connecting erlang to hardware/other software

How does one go about connecting erlang to other programs? In erlang the movie, they have erlang running with the telephone system, but surely the telephone system wasn't programmed in erlang was it? If it wasn't, how did they make the 2 programs communicate?

For example, if I have a rails app and would like to connected to an erlang program(without) gems, how would I go about this? Sockets?

This is something I'm having trouble finding docs on but hear about it all the time, like facebook is built with php/hiphop but their chat runs on erlang. Maybe there's a name in the programming world by which they call this functionality that I don't know of.

One guess is pointers? Maybe exchaging information through addresses in memory?

Upvotes: 0

Views: 88

Answers (1)

7stud
7stud

Reputation: 48589

In erlang the movie, they have erlang running with the telephone system, but surely the telephone system wasn't programmed in erlang was it?

Erricson created Erlang specifically to program the telephone system.

How does one go about connecting erlang to other programs?

That is an Erlang faq question. See here:

http://www.erlang.org/faq/how_do_i.html

For example, if I have a rails app and would like to connected to an erlang program(without) gems, how would I go about this? Sockets?

Okay, now you've switched directions, now you say you want ruby to execute an Erlang program. One way:

myprog.rb:

puts 'Hello from Ruby program!'
system('escript erlang_hello dog')

erlang_hello:

[blank line]
[blank line]
main([String]) ->
    io:fwrite("Hello from Erlang program!\n"),
    io:format("You called with: ~s\n", [String]);
main(_) ->
    io:fwrite("You called with no arguments!\n").

A couple of blank lines are required at the top of the erlang script.

~/ruby_programs$ ruby myprog.rb 
Hello from Ruby program!
Hello from Erlang program!
You called with: dog

Upvotes: 4

Related Questions