Tcl/Tk

Per Bohlin per.bohlin@REDACTED
Tue Mar 28 08:24:30 CEST 2000


Hi Magnus!

I like the idea of what you are trying to do. It has some resemblance to
what 
I have done in GTE. The tool used to make the Motif user interfaces for 
some element management systems at Ericsson.

My theory about your problem is simply as follows.

erl_interface and ei are only there for static linking.
When you make a shared library, which you do, no linking is done.
The -l flags you give only puts information in the library that 
those libraries in theire turn should be loaded when your library is
loaded.
Thus you get no error when compiling.

When running there is no erl_interface and ei to load so the first
function
in there that gets called fails. That first function would be erl_init 
which is a macro defined to call erl_init_nothreads in your case.

But this is just a theory. I only have experience of using the SUN
Workshop
compilers to make shared libraries. I think that would complain in the 
compilation phase.

If you have the source code you should be able to make shared library
versions 
of erl_interface and ei.

Regards

Per Bohlin



Ljung Magnus wrote:
> 
> Hi!
> 
> I want to add an Erlang programming language interface to a Tcl/Tk
> application. I'm using the erl_interface to C with the libraries libei.a
> and liberl_interface.a. Compiling and inking a stand-alone application
> C-Erlang works. When compiling a loadable package to Tcl/Tk adding a Tcl
> command using one of the Erlang C library function something goes wrong.
> Loading the shared library in tclsh I get the error:  relocation error:
> file /home/etxmljg/application/app.o: symbol erl_init_nothreads:
> referenced symbol not found
> 
> I guess this means that the runtime linker cant find the function in the
> Erlang library. The result is the same for PTHREADS and STHREADS as
> well. Is there any environment variable that I have missed or does it
> depend on how the Erlang libraries have been compiled?
> 
> Compiler flags used:
> gcc -O2 -shared -fPIC -R/EDUP/Otp/0/lib/erl_interface-3.2/lib
> -I/EDUP/Tcl/0/include/ -L/EDUP/Tcl/0/lib
> -I/EDUP/Otp/0/lib/erl_interface-3.2/include
> -L/EDUP/Otp/0/lib/erl_interface-3.2/lib  \
>  -lerl_interface -lei -lm -ltcl app.c -o app.so
> 
> Regards // Magnus



More information about the erlang-questions mailing list