ErlInterface (sorry, here goes another question)

Rick Pettit rpettit@REDACTED
Thu Aug 14 19:27:23 CEST 2003


I whipped up a sample ei program that connects to a remote node and attempts
to send a message to a registered process on that node. The message is simply
the atom 'hello_world'.

Attached is the Makefile and main.cpp src file. This builds (OpenBSD 3.3
Current running OTP R9C-0):

rpettit@REDACTED /home/rpettit/EI # gmake
g++  -c -I/usr/local/lib/erlang/lib/erl_interface-3.4/include main.cpp
g++  main.o -L/usr/local/lib/erlang/lib/erl_interface-3.4/lib -lerl_interface -lei -lpthread -o ei-test
/usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(ei_connect.o): In function `ei_connect_init':
/home/rpettit/downloads/erlang/OTP-R9C/otp_src_R9C-0/lib/erl_interface/src/connect/ei_connect.c:491: warning: sprintf() is often misused, please use snprintf()
/usr/local/lib/erlang/lib/erl_interface-3.4/lib/libei.a(show_msg.o): In function `ei_trace_printf':
/home/rpettit/downloads/erlang/OTP-R9C/otp_src_R9C-0/lib/erl_interface/src/misc/show_msg.c:81: warning: vsprintf() is often misused, please use vsnprintf()

Disregard the error messages (or don't ;-), it is complaining about "unsafe"
string routines being called from the ei library.

The problem is the program produces output that seems to indicate I goofed a
pointer somewhere:

rpettit@REDACTED /home/rpettit/EI # ./ei-test 
Calling ei_connect_xinit()
Calling ei_xconnect()
Calling ei_reg_send()
Pphagdei-test-node@REDACTED
                                                 hello_worldLooks like it worked!

If I comment out the call to ei_reg_send() then I only see:

Calling ei_connect_xinit()
Calling ei_xconnect()
Calling ei_reg_send()

Which seems to indicate that the trouble is with the call to ei_reg_send(). I
thought my sample was pretty much straight out of the docs, with minor mods
(the atom sent, etc).

Any suggestions welcome.

Thanks,

-Rick

P.S. Perhaps someone has done work with ei (sample apps, etc) that they would
     like to post a link to?



More information about the erlang-questions mailing list