Library organization

121 views
Skip to first unread message

GianLuigi Piacentini

unread,
Oct 10, 2016, 12:21:29 PM10/10/16
to
Hi all,

for several reasons, I would like to restructure my Fortran libraries
(.a files under Linux).
I plan to keep downloaded libraries (LAPACK, Math77, SLATEC, NSWC) each
in its own .a file, but I tend (so far) to have only one .a file for my
work (mainly easy-to-use Fortran>90 wrappers to some procedure from the
above libs, plus some work of mine - simple math, some geometry, some
string processing).
In your experience, do you think is a sensible choice, or better to have
a .a file dedicated to each subject (like mymath.a, mygeometry.a and so
on) ?

Thanks in advance

Gigi

Stefano Zaghi

unread,
Oct 10, 2016, 1:19:12 PM10/10/16
to
Dear Gigi,

maybe I am OT, but I prefer to try to adhere the KISS principle, thus I like to have many (tiny) ".a" rather a big ("monster") one. Aside the size issue, I think that separate libraries (also compiled objects) allow a more clear and maintainable workflow (for both the libraries themselves and the project using those libraries), anyhow I am not aware of "actual issues" when many libraries are "ranlib"ed together with respect separating them.

Surely, I am a bad sysadmin, thus I ignore many aspects: for example, if you want to distribute your libraries a compiled objects, which are the "best practice" for the "very-not-portable" .mod files?

My best regards.

GianLuigi Piacentini

unread,
Oct 11, 2016, 2:21:37 PM10/11/16
to
Funny, two italians that write each other in english ...
Anyway, I never redestributed a library, so I do not have suggestions
about. For my own (hobbyst) use, I tend to have a directory somewhere,
called with the name and version of the compiler used to compile the
library. Inside there are 2 subdirs:
bin
for .a files and their makefiles
mod
where mod files from these libraries land

But programs using them never exit my computer...
Hoping this helps...

Gigi

P.S.
The more I mumble about, the more I like your approach of small
dedicated libraries - that was my previous approach at the problem. This
need several lib explicitly linked, but no problem, I always use
makefiles, albeit very simple ones.

Thanks Stefano, go ahead with your FOSS work!

Stefano Zaghi

unread,
Oct 11, 2016, 3:16:13 PM10/11/16
to
Dear Gigi,

Il giorno martedì 11 ottobre 2016 20:21:37 UTC+2, GianLuigi Piacentini ha scritto:
> Funny, two italians that write each other in english ...

:-) Yes, very funny. Indeed, I exploit this group for 2 aims: improve my Fortran skills and improve my terrible English :-)

> Anyway, I never redestributed a library, so I do not have suggestions
> about. For my own (hobbyst) use, I tend to have a directory somewhere,
> called with the name and version of the compiler used to compile the
> library. Inside there are 2 subdirs:
> bin
> for .a files and their makefiles
> mod
> where mod files from these libraries land
>
> But programs using them never exit my computer...
> Hoping this helps...

Thank you for the explanation. I think this a common practice, at least I have already read similar approaches.

> P.S.
> The more I mumble about, the more I like your approach of small
> dedicated libraries - that was my previous approach at the problem. This
> need several lib explicitly linked, but no problem, I always use
> makefiles, albeit very simple ones.
>
> Thanks Stefano, go ahead with your FOSS work!

I changed my workflow some years ago for "all another kind of reasons"... anyhow, KISS philosophy is now very well fitted with my needs.

Thank you too Gigi, see you soon!
Reply all
Reply to author
Forward
0 new messages