On Fri, 18 Jun 1999, Rafael Marco de Lucas wrote:
>   but each time the program runs with a different formula i will have to
>  compile again the code, and i will have to build a new executable file
>  and run it, isn't it?   i would prefer to run a single executable code
>  and not to jump from one to other (ie. using atexit from stdlib.h)
>    is it possible to compile/link just a function and call it from the initial
>  program (i mean, to add a function to the program while it is running in a way
>  that i do not need to exit from the initial program ) ?

That makes your original question clearer.  Yes, it is possible.  You need
to fork a command that will build the function as a shared library (even
though in this case your library has only one member!) and then load it
explicitly rather than linking your main program with it.  The explicit
dynamic loading functions are in libdl (see `info ld.so libdl` for
details and examples).

You're going to learn a lot about dynamic linking along the way.
Unfortunately you can't learn much more of it from me, because I haven't
done this myself -- not on Unix, anyway.  But I know enough about the
facilities to believe that what you want can be done.

-- 
Mark H. Wood, Lead System Programmer   [EMAIL PROTECTED]
Specializing in unusual perspectives for more than twenty years.

Reply via email to