This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Static compilation to generate shared library
- From: ccodehelp <iitb dot ankit at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Sun, 15 Jul 2007 12:42:43 -0700 (PDT)
- Subject: Static compilation to generate shared library
Hi,
I am not well acquainted with the gcc '-static' flag and need some help with
the following problem:
1. I have a C program with various functions which I want to compile into a
library. Call this func_lib.c
2. There's a separate C file logger.c which contains a function logger()
which is called by each function in func_lib.c for the purpose of logging.
logger() uses stdio.h for printf() etc.
3. I want to compile func_lib.c into libfuncs.so
What I'm doing as of now is:
gcc -c -static logger.c
gcc -c -static func_lib.c
gcc -static -Wall -o2 -fPIC -shared -ldl -g -o libfuncs.so logger.o
func_lib.o
All compiles well and I get the .so library
But this is not doing what I want. My intention is to make libfuncs.so such
that it does not depend on any other libraries like libc.so etc that is all
the byte code from there is also present in this.
Also I do not want a .a file because I'm using this .so file with LD_PRELOAD
I hope I have clarified enough on the question. Please help out
Thanks in anticipation.......
--
View this message in context: http://www.nabble.com/Static-compilation-to-generate-shared-library-tf4083168.html#a11605239
Sent from the gcc - Help mailing list archive at Nabble.com.