I want to use Autotools in order to create a .so file, so that I can load it using dlsym. I have read some similar topics, but none of the suggested solutions did the trick for me. Here is what i have:
I want to compile a simple hello.cpp to a .so.
configure.ac
AC_INIT(My Project, 0.1, my@email, myproject)
AC_PREREQ(2.68)
AC_COPYRIGHT(GNU General Public License)
AM_CONFIG_HEADER([config.h])
AC_PROG_CXX
AM_INIT_AUTOMAKE([1.9 foreign])
AC_CONFIG_FILES(Makefile)
AC_ENABLE_SHARED
AC_DISABLE_STATIC
LT_INIT
AC_OUTPUT
Makefile.am
lib_LTLIBRARIES = libtest.la
libtest_la_SOURCES = hello.cpp
libtest_la_LDFLAGS = -version-info 0:0:0
I got this idea from here, but when I type in:
autoreconf -i
./configure
make
I get a libtest.la file, but sadly no .so file. If it helps this is how i normally compile the hello.cpp into a hello.so:
g++ -Wall -shared -rdynamic -fPIC hello.cpp -o hello.so
I would be grateful if anyone told me what I am doing wrong, so that i finally get the .so file.