开发者

How do I find out what programming language a specific piece of software is written in?

Whether I'm using a freeware countdown timer, a utorrent client, video player, etc. is there an easy way to find out what programming language it is written in? Espe开发者_如何学Pythoncially if it is one of the more mainstream programming languages such as C, C++, Java, Perl, Basic, etc.

I'm familiar with PHP and JavaScript for web use and have no trouble opening and editing those files, but now that I'm looking to pick up a non-web programming language, I would like to increase the scope of my skills a bit. I'm having a bit of difficulty finding out what language the various applications I personally use were written in. I would like to compare languages with real-life examples that I'm familiar with.


Examining the list of shared libraries (DLLs in Windows-speak) of a compiled program can give a clue, because typically each language has a specific distinctive library to provide the runtime environment.

For example, on my Linux PC, running the ldd command on an executable produced the following tell-tale output:

ldd *redacted*
    linux-gate.so.1 =>  (0x0042e000)
    libxerces-c.so.28 => /usr/local/lib/libxerces-c.so.28 (0x004b0000)
    *redacted*.so => not found
    libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x05f28000)
    libm.so.6 => /lib/libm.so.6 (0x00a61000)
    libgcc_s.so.1 => /lib/libgcc_s.so.1 (0x05be0000)
    libc.so.6 => /lib/libc.so.6 (0x00906000)
    libpthread.so.0 => /lib/libpthread.so.0 (0x00a93000)
    /lib/ld-linux.so.2 (0x008e7000)

The use of libc.so suggests C or C++. The use of libstdc++.so suggests C++. In fact that was a C++ program.

Searching the program executable for human readable strings can also given clues, especially if it has debugging information present.

For example, running the strings command on that same executable revealled (among much other text) the following tell-tale strings:

virtual std::ostream* XmlToDcs::AmsResultsHandler::createOutputFileIfPossible()
pointer != static_cast< unsigned int >(-1)
std::ofstream* XmlToDcs::IndexElementsHandler::createStatementsFile(const tm&, char, char, unsigned int)
EamResultsHandler.cpp

The first three look like fragments of C++, the last looks like the name of a C++ source code file.


I'd say that nowadays, most common programming languages used for desktop applications would be C++, .Net and Java (don't know about apps on Macs).

I think the thing to consider is more what you want to achieve and on which plateforms you want it to run. Java will give you all platforms for free, provided the user has a JVM on his computer. .Net will make it easy to develop for Windows but requires tools from Microsoft sometimes having a free but limiting license but usually expensive. C++ will allow you to develop for multiple platforms but involves more effort to make your program portable and to compile it for several OS/processors.

To identify .Net or Java programs, simply read the README file provided with the program. I will state that you need a certain version of the .Net framework or of a Java Virtual Machine to run the program.

Also check if the program is simply a script, if it needs an interpreter (PHP, LUA, Python, ...). That should also be mentionned in the README file.

Harder will be to distinguish between C and C++. Both get compiled to an EXE file and do not require any kind of external virtual machine to run.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜