making executables do tricks

William J. Bouma bouma at cs.purdue.EDU
Mon Mar 26 08:16:27 AEST 1990


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 at cs.purdue.edu>  |  And don't forget my dog... "Astronomy" -- BOC



More information about the Comp.unix.questions mailing list