$ java -cp classes edu.hawaii.ics332.dcl.DynamicClassLoading input string $ python dynamic_loading.py 37 dynamic_loading.py:7: SyntaxWarning: name '_sqrt' is used prior to global declaration global _sqrt # Make _sqrt a global entity Attempt 1 Trying to execute function _sqrt() Exception caught: Importing math Trying to execute function _sqrt() 6.0827625303 Attempt 2 Trying to execute function _sqrt() 6.0827625303 $ make gcc -fPIC -DPIC -c custom_shared_library_exit.c -o custom_shared_library_exit.o ld -shared -ldl -o custom_shared_library_exit.so custom_shared_library_exit.o gcc noop.c -o noop You can now run the noop program just like this: ./noop Or do a 'export LD_PRELOAD=/home/esb/tmp/custom_shared_library_exit.so' before running it! $ ./noop I am a program that does nothing! $ export LD_PRELOAD=/home/esb/tmp/custom_shared_library_exit.so $ ./noop I am a program that does nothing! ** PROGRAM TERMINATING !** $ export LD_PRELOAD="" $ make gcc -fPIC -DPIC -c custom_shared_library_mem.c -o custom_shared_library_mem.o ld -shared -ldl -o custom_shared_library_mem.so custom_shared_library_mem.o gcc leaky.c -o leaky You can now run the noop program just like as ./leaky. Or do a 'export LD_PRELOAD=/home/esb/tmp/custom_shared_library_mem.so' before running it! $ ./leaky $ export LD_PRELOAD=/home/esb/tmp/custom_shared_library_mem.so $ ./leaky Warning: your code places 10 calls to malloc, but 1 calls to free $ export LD_PRELOAD=""