views:

213

answers:

6

is there something like .dll or .so,but crossplatform?

+3  A: 

not for c/c++ AFAIK, java has .jar files that are sort of analogous though.

vicatcu
+7  A: 

Java .class files and .jar archives will fulfil this requirement, as will .Net assemblies running under Mono.

Brian Agnew
They don't really fulfill the requirement for a plethora of reasons -- he isn't asking if there are languages which have a compilation unit that is architecture and vendor indepement :/ You shouldn't state such bold totalities without any disclaimers.
Hassan Syed
The question say "is there something like...". I think the above fits that 'requirement' quite well. I'm not talking about languages in the above. I'm talking about platforms (JVM or .Net)
Brian Agnew
+5  A: 

A universal executable format? No.

That's the whole reason for the existence of virtual machines (java) or IL (.Net) - so the same source code can be compiled into a universal intermediate language, that can then be executed by the framework in the underlying system bytecode without the programmer having to know the differences between the systems.

In practice, the VM has to be consistently implemented on all platforms.

womp
+1  A: 

As others have mentioned, not really. Perhaps LLVM will one day bridge the gap allowing us to look at LLVM equivalents as we do static/dynamic object libraries.

Take a look at this reply for some of the reasons why static object libraries aren't generally portable. I say generally because sometimes -- if the OS vendors care enough -- it is possible -- like freebsd executing linux binaries, or WINE implementing a large part of the win32 runtime.

Hassan Syed
A: 

Binary object files are almost always bound to a particular platform. As others have already said, the object file formats that come closest to platform independence might well be .NET/Mono assemblies and Java bytecode.

That said, if you want real platform independence, you might be best off with source code (if that is an option). I know this is not what you ask, but consider that these days, you'll be able to compile a C++ program on most machines (e.g. with the GNU Compiler Collection), if your C++ code is itself platform-agnostic.

stakx
+1  A: 

its not clear what u are asking. But if you are asking "how can I make dynamically loadable C/C++ libraries in a cross platform manner" then the awswer is gnu libtools. This has support for building and consuming them. Plus runtime support functions

http://www.gnu.org/software/libtool/

pm100