I was wondering if one could do the following. I have some shared library mylib.so compiled natively in 64bit Linux with the gfortran compiler. I new this was not going to work but I took that library and try to write a simple code which calls it in FreeBSD. Then compile the main.cpp natively in FreeBSD and tried to link the main.o with the mylib.so which was compiled in Linux and it is a native Linux library. I could not link. I got errors.
Do not please tell me to compile the executable in Linux and run it in FreeBSD through the Linux compatibility ABI. I do not want to run a Linux executable in FreeBSD. I do not care. I want to be able to compile code in FreeBSD and link it with this Linux library. In order to do this I should be able to remove any code related to Linux and replace it with the corresponding code (from the object file) a freebsd library should have.
Anyways I could achieve that?