[comp.unix.questions] making executables do tricks

bouma@cs.purdue.EDU (William J. Bouma) (03/26/90)

Please provide the unix calls to do the following:

1. State saving executable.

main()
{
    INTITIALIZATIONS;
    ...;
    savecore(filename);
    X;
    ...;
}

'savecore' should create an executable file which begins execution at
statement X and retains the state information from the INTITIALIZATIONS.
I realize that some state info could not be saved, (eg open file pointers),
but I am mainly interested in 'malloc'ed memory. Is it possible to save
the dynamically allocated memory in a binary?

2. Dynamic loading of functions.

main()
{
    ...;
    loadfile("func.o");
    exec_named_function("func", arg1, arg2);
    ...;
}

'loadfile' should make the functions in "func.o" accessible to the currently
running binary. 'exec_named_function' should find the function named "func"
and execute it like func(arg1, arg2).
-- 
Bill <bouma@cs.purdue.edu>  |  And don't forget my dog... "Astronomy" -- BOC