Can a library written in one programming language be linked with a program written in some other language? Is object code from two different programming languages that do the exact same thing (e.g add two numbers and divide by another) have the same object code?
It depends on the languages, platform, and compilers used: sometimes yes, sometimes no. At one extreme, it's traditionally been very easy, for example, to use FORTRAN libraries from C. At the other end, languages with complicated runtime systems (VMs like Java, or scripting languages like Python or Ruby) usually need some special intermediate "glue" code to make things work, but even in those cases, it's usually achievable.