Re: [Anjuta-list] how to create a shared library
- From: Sébastien Granjoux <seb sfo free fr>
- To: anjuta-list lists sourceforge net, Sunil Negi <vick ram79 yahoo com>
- Subject: Re: [Anjuta-list] how to create a shared library
- Date: Sun, 09 Aug 2009 23:00:26 +0200
Hi Sunil,
I have tried here to compile a small shared library. I have done a few
trials but it's working now.
1. The shared library project
1.1 Create a minimal anjuta project
1.2 In configure.ac, to enable libtool support, add the line
AM_PROG_LIBTOOL just after
AC_ISC_POSIX
AC_PROG_CC
AM_PROG_CC_STDC
AC_HEADER_STDC
1.3 In Makefile.am replace
bin_PROGRAMS = foobar_sample by lib_LTLIBRARIES = libfoobar_sample.la
The prefix lib is standard and the right extension is .la, then
foobar_sample_SOURCES = main.c by libfoobar_sample_la_SOURCES = main.c
That's all. The autogen.sh script created with the project already check
for AM_PROG_LIBTOOL in the configure.ac script and run libtoolize as needed.
So you just need to run autogen (to create ltmain.sh) then make && make
install.
2. The program using the shared library
I think you don't need this if you just want to create an extension for
nautilus, but I have done it to check that my shared library is working.
1.1 Create a minimal anjuta project
1.2 In configure.ac, you need to add libtool support if it's not done. I
have used an old project where it was not defined, so I have added the
line AM_PROG_LIBTOOL like in the first program.
1.3 In Makefile.am add the line
foobar_sample_LDADD = -L/usr/local/lib -lfoobar_sample
You need to define both the library name (without the lib prefix) and
the directory where it can be found.
Regards,
Sébastien
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]