When compiled as a stand-alone program, my code always behaves as I expect it to.
However, I've also compiled my code as a shared library. For some reason, calling the library from both Java (using JNI) and Python (using ctypes) gives unpredictable results. In other words, the data I get back from the library is incorrect between 1% and 10% of the time. I can't figure out why this would be since the code being run for both versions is practically identical.
Does anyone have any ideas as to why this might happen?
To give you a better picture, I'm compiling the code (for Python) with commands similar to the following:
Code:gcc -c -fPIC -O3 Main.c objcopy --input binary --output elf64-x86-64 --binary-architecture i386 prog.dat data.o gcc -shared -Wl,-soname,libmain.so -o libmain.so Main.o data.o