Useful Hack

Python’s ctypes is great for loading DLLs and other code into python. Recently I’ve been trying to use python to grab into the internals of an application rather than a library. This has presented a few hurdles. To get around it you can build the static libraries into a shared libraries by running:

gcc -shared *.o -o whatever.so

then you can load the whatever.so with the regular:
lib = ctypes.CDLL(“./whatever.so”)

Leave a Reply

You must be logged in to post a comment.