Q:

Is it possible to combine C++ with any language?

I heard from a book (Professional C++ Edition 2) that C++ can be combined with many languages, close to all, by using extern. For example:
extern "Lua" {
     //Some code in Lua
};

extern "Python" {
     //Some code in Python
};

extern "C" {
     //Some code in C
};

int main(int argc, char* argv[]){
     //Some C++ code
     return 0;
}

Now I know that you can combine C and ASM with C++, but like I said before, can we use a lot more other languages like Lua, Python, PHP, etc? Or does it only work with languages that are dependent on C/C++?

A:

I'm really not qualified to answer this question, but I'll do the best I can.
According to the documentation for extern, it provides for linkage between modules written in different programming languages.

Language linkage encapsulates the set of requirements necessary to link with a module written in another programming language: calling convention, name mangling algorithm, etc.

That may lead one to believe that, as allegedly claimed by the book, one could combine C++ with many other languages by using extern. That is simply not the case. Compilers only really support "C", and "C++". "C++" being the default and "C" being used to

link with functions written in the C programming language, and to define, in a C++ program, functions that can be called from the modules written in C.

This is due to the fact that C++ is a close relative of C, and most C++ compilers know how to compile C code.
(It's actually more complicated than that, see this, and this) You can also embed assembly in C++, albeit not in a portable way. 
Now that doesn't mean that other languages can't be combined with C++. You can, for instance, extend python, where you can load modules written in C++, and you can embedd python into C++, where a C++ program invokes the Python interpreter as a soubroutine. See Boost Python. Similarly you can embedd Lua in C++, and I'm sure many other scripting languages can be embedded. The point is that it's more complicated than just using extern, you need libraries for that specific purpose, and embedding each different language has its own unique complications.
As for why the book made such a claim, maybe you misunderstood it, as one could have misunderstood the documentation snippet above? In any case, any C++ book that would leave any level of ambiguity in that matter is probably not a very good book. I would hardly imagine that you should read any other C++ book until you have read all of the ones in The Definitive C++ Book Guide and List.

