EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: build shared library using static library
From: Mark Rivers <[email protected]>
To: "'Pavel Maslov'" <[email protected]>, EPICS Tech Talk <[email protected]>
Date: Mon, 22 Sep 2014 16:19:01 +0000

Hi Pavel,

 

That may depend on which architecture you are talking about.

 

On Linux it is definitely possible to link a static library (.a) into the shared support library (.so).

 

Here is an example.   My Makefile contains this line:

 

LIB_LIBS += PvAPI

 

This is libPvAPI.a, which is a static vendor library:

-r--r--r-- 1 epics epics 2053154 Aug  6 09:34 libPvAPI.a

 

When I link my shared support library this is what I get:

-r-xr-xr-x 1 epics epics 1250968 Sep 22 11:08 libprosilica.so

 

Note that it is about 1.25 MB.

 

I then comment out the LIB_LIBS line in my Makefile and build again.  This is what I get:

 

-r-xr-xr-x 1 epics epics  115746 Sep 22 11:09 libprosilica.so

 

So now it is only 0.12 MB because libPvAPI.a is not linked into the shareable library.

 

Interestingly you will note that Linux does not give an error when the LIB_LIBS line is commented out.  Linux is happy to build a shareable library with unresolved references. In this case libPvAPI.a would need to be linked into the final application, but it does not need to be linked into the shareable library.

 

This is NOT true on Windows, either Visual Studio or Cygwin.  In that case when building the shareable library (.dll) all references must be resolved, so the LIB_LIBS link is required.

 

I believe that Windows will also allow linking a static library into a DLL, but I could not quickly find an example to prove it.

 

Mark

 

 

 

 

 

 

From: [email protected] [mailto:[email protected]] On Behalf Of Pavel Maslov
Sent: Monday, September 22, 2014 10:34 AM
To: EPICS Tech Talk
Subject: build shared library using static library

 

Hello,

 

Is it possible to build a shared library (EPICS support module) using one or more static libraries?

I know that it works out when building an IOC. But what about support libs?

 


Regards,
Pavel Maslov, MS


References:
build shared library using static library Pavel Maslov

Navigate by Date:
Prev: build shared library using static library Pavel Maslov
Next: Bug in autosave 5.4 Ralph Lange
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: build shared library using static library Pavel Maslov
Next: Bug in autosave 5.4 Ralph Lange
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 17 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·