How to get architecture of a shared object file(.so file) using gnu c++ program?
<p>I have to create a c++ program to find out the whether the *.so(shared object) file is 32 bit or 64 bit (ex, libjvm.so). I did the same for dll files in windows, but got stuck on non-windows shared object file.</p>

<p>There are many commands available in Linux to find this out. But i don't see a simple programmatic ways to get this. The command objdump source code is having so many stuffs, not sure i can replicate it in my code.</p>

<p>I don't want to call the commands using system("") function inside my code, to get the architecture details. </p>

<p>Any idea how to get the architecture of .so file using gnu c++ program.</p>

<p>I am using Linux RHEl 6.2 and Compiler GNU gcc 4.8.3.</p>

<p>Thanks</p>