tags:

views:

29

answers:

2

What is native library? What is binding? Why it is needed?

+1  A: 

A native library is a library written in a language that compiles down to native code for the platform it runs on, i.e. C++ creating PE files with x86 code. A binding, or language binding is the "glue" that makes it possible / more comfortable to use such a library from within another programming language, possibly providing a more elegant interface than just calling directly into the native code (think: better than P/Invoke, for example).

The question as to why it is needed is a simple one: To use the very large number of already existing libraries.

Jim Brissom
+1  A: 

Why is it needed? Partially because the parts of language abilities outside of Turing equivalence. Turing Equivalence says that all Turing complete languages(which includes most programming languages) can calculate the same stuff. Which means anything you can do in one language you can do in another, with several important caveats.

Major Caveats include

a) It might be much more difficult to write code to do x in language A then language B.
b) Code that does x in Language B might be faster then language A.
c) The code to do x might already be written in the form of a nice library in language A but not language B.

d) Code in one language may be more scalable (easier to manage larger bodies of code) then in another language.

e) You usually need not only to be able to do mathematical calculations, but also Input/Output with local files, databases, network accessed files,web services, gui including system windowing server and possibly toolkit, and access to the 3d api driving the graphics card.

These reasons, especially e describe why you may want to make bindings/wrap a piece of code frequently written in a lower level system language to use it as part of application written in a higher level language. Connecting pieces of code written in different languages can also sometimes be accomplished through code communication such as databases/inter process communcation/web services.

Roman A. Taycher