public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* How to link a static lib when build a shared lib ?
@ 2009-08-08 12:17 Andy
  2009-08-10 11:43 ` Ian Lance Taylor
  0 siblings, 1 reply; 2+ messages in thread
From: Andy @ 2009-08-08 12:17 UTC (permalink / raw)
  To: gcc

Hi all,
I got that, glibc can support SHA in crypt lib since v2.7.

There is a requirement in my application to use SHA, but update the
whole glibc is too risky. So I want to build a specific crypt lib for
the module using crypt function in my application.

Now the calling graph seems like this, from a simple view.

crypt_user.c  ---->  call crypt() function in libcrypt.so

myutil.c  -----> call functions in crypt_user.c, and it will be build
to a shared lib, libmyutil.so

Executable program : server -----> need to use libmyutil.so to work.

Now I can ONLY use the latest static lib  libcrypt.a from the new
glibc. How should I use it ? Link it when build libmyutil.so or build
server ?

I tried to update my Makefile to link the libcrypt.a, but seems that
the called crypt function is not as I expected, it's still from the old glibc.

Could anybody give me a help with how to use the gcc option and write
a working Makefile ?

Any reply will be appreciated!

Thanks,

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: How to link a static lib when build a shared lib ?
  2009-08-08 12:17 How to link a static lib when build a shared lib ? Andy
@ 2009-08-10 11:43 ` Ian Lance Taylor
  0 siblings, 0 replies; 2+ messages in thread
From: Ian Lance Taylor @ 2009-08-10 11:43 UTC (permalink / raw)
  To: Andy; +Cc: gcc

Andy <hewanxiang@gmail.com> writes:

> I got that, glibc can support SHA in crypt lib since v2.7.
>
> There is a requirement in my application to use SHA, but update the
> whole glibc is too risky. So I want to build a specific crypt lib for
> the module using crypt function in my application.
>
> Now the calling graph seems like this, from a simple view.
>
> crypt_user.c  ---->  call crypt() function in libcrypt.so
>
> myutil.c  -----> call functions in crypt_user.c, and it will be build
> to a shared lib, libmyutil.so
>
> Executable program : server -----> need to use libmyutil.so to work.
>
> Now I can ONLY use the latest static lib  libcrypt.a from the new
> glibc. How should I use it ? Link it when build libmyutil.so or build
> server ?
>
> I tried to update my Makefile to link the libcrypt.a, but seems that
> the called crypt function is not as I expected, it's still from the old glibc.
>
> Could anybody give me a help with how to use the gcc option and write
> a working Makefile ?

This is the wrong mailing list.  gcc@gcc.gnu.org is for discussion by
gcc developers.  You can try gcc-help@gcc.gnu.org.

What you are trying to do is not supported.  I would recommend simply
finding source code for the SHA function--you should be able to find it
on the web--and using that.

Ian

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-08-10  9:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-08 12:17 How to link a static lib when build a shared lib ? Andy
2009-08-10 11:43 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).